framework/source/accelerators/acceleratorconfiguration.cxx | 15 +- framework/source/accelerators/documentacceleratorconfiguration.cxx | 4 framework/source/accelerators/presethandler.cxx | 30 ----- framework/source/inc/accelerators/presethandler.hxx | 13 -- framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx | 10 + svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx | 7 - svx/source/sidebar/paragraph/ParaLineSpacingControl.hxx | 4 svx/source/sidebar/paragraph/ParaLineSpacingPopup.cxx | 35 +---- svx/source/sidebar/paragraph/ParaLineSpacingPopup.hxx | 10 - sw/source/uibase/inc/workctrl.hxx | 1 sw/source/uibase/ribbar/workctrl.cxx | 59 ++++------ vcl/source/window/builder.cxx | 23 ++- 12 files changed, 72 insertions(+), 139 deletions(-)
New commits: commit 56019dcb79475606952a954fe732a3109441ffec Author: Jan Holesovsky <ke...@collabora.com> Date: Thu Oct 30 08:11:04 2014 +0100 cleanup: We re-init this member all the time anyway. Also kill some unused measuring. Change-Id: I69521d36e4da4b50cd58f346f0adb0e5563c8bec diff --git a/sw/source/uibase/inc/workctrl.hxx b/sw/source/uibase/inc/workctrl.hxx index 567a0d0..493b164 100644 --- a/sw/source/uibase/inc/workctrl.hxx +++ b/sw/source/uibase/inc/workctrl.hxx @@ -76,7 +76,6 @@ public: class SwTbxAutoTextCtrl : public SfxToolBoxControl { PopupMenu* pPopup; - SwView* pView; void DelPopup(); public: diff --git a/sw/source/uibase/ribbar/workctrl.cxx b/sw/source/uibase/ribbar/workctrl.cxx index ef1e5b7..d191cfd 100644 --- a/sw/source/uibase/ribbar/workctrl.cxx +++ b/sw/source/uibase/ribbar/workctrl.cxx @@ -49,8 +49,6 @@ #include <vcl/svapp.hxx> - - // Size check #define NAVI_ENTRIES 20 #if NAVI_ENTRIES != NID_COUNT @@ -164,8 +162,7 @@ SwTbxAutoTextCtrl::SwTbxAutoTextCtrl( sal_uInt16 nId, ToolBox& rTbx ) : SfxToolBoxControl( nSlotId, nId, rTbx ), - pPopup(0), - pView(0) + pPopup(0) { rTbx.SetItemBits( nId, ToolBoxItemBits::DROPDOWN | rTbx.GetItemBits( nId ) ); } @@ -177,46 +174,38 @@ SwTbxAutoTextCtrl::~SwTbxAutoTextCtrl() SfxPopupWindow* SwTbxAutoTextCtrl::CreatePopupWindow() { - pView = ::GetActiveView(); + SwView* pView = ::GetActiveView(); if(pView && !pView->GetDocShell()->IsReadOnly() && !pView->GetWrtShell().HasReadonlySel() ) { - ToolBox& rBox = GetToolBox(); + Link aLnk = LINK(this, SwTbxAutoTextCtrl, PopupHdl); - Rectangle aItemRect( rBox.GetItemRect( GetId() ) ); - Point aPt(rBox.OutputToScreenPixel(aItemRect.TopLeft())); - aPt.X() += aItemRect.GetWidth()/2; - aPt.Y() += aItemRect.GetHeight()/2; - if(pView) + pPopup = new PopupMenu; + SwGlossaryList* pGlossaryList = ::GetGlossaryList(); + const size_t nGroupCount = pGlossaryList->GetGroupCount(); + for(size_t i = 1; i <= nGroupCount; ++i) { - Link aLnk = LINK(this, SwTbxAutoTextCtrl, PopupHdl); - - pPopup = new PopupMenu; - SwGlossaryList* pGlossaryList = ::GetGlossaryList(); - const size_t nGroupCount = pGlossaryList->GetGroupCount(); - for(size_t i = 1; i <= nGroupCount; ++i) + OUString sTitle = pGlossaryList->GetGroupTitle(i - 1); + const sal_uInt16 nBlockCount = pGlossaryList->GetBlockCount(i -1); + if(nBlockCount) { - OUString sTitle = pGlossaryList->GetGroupTitle(i - 1); - const sal_uInt16 nBlockCount = pGlossaryList->GetBlockCount(i -1); - if(nBlockCount) + sal_uInt16 nIndex = static_cast<sal_uInt16>(100*i); + // but insert without extension + pPopup->InsertItem( i, sTitle); + PopupMenu* pSub = new PopupMenu; + pSub->SetSelectHdl(aLnk); + pPopup->SetPopupMenu(i, pSub); + for(sal_uInt16 j = 0; j < nBlockCount; j++) { - sal_uInt16 nIndex = static_cast<sal_uInt16>(100*i); - // but insert without extension - pPopup->InsertItem( i, sTitle); - PopupMenu* pSub = new PopupMenu; - pSub->SetSelectHdl(aLnk); - pPopup->SetPopupMenu(i, pSub); - for(sal_uInt16 j = 0; j < nBlockCount; j++) - { - OUString sLongName(pGlossaryList->GetBlockLongName(i - 1, j)); - OUString sShortName(pGlossaryList->GetBlockShortName(i - 1, j)); - - OUString sEntry = sShortName + " - " + sLongName; - pSub->InsertItem(++nIndex, sEntry); - } + OUString sLongName(pGlossaryList->GetBlockLongName(i - 1, j)); + OUString sShortName(pGlossaryList->GetBlockShortName(i - 1, j)); + + OUString sEntry = sShortName + " - " + sLongName; + pSub->InsertItem(++nIndex, sEntry); } } } + ToolBox* pToolBox = &GetToolBox(); sal_uInt16 nId = GetId(); pToolBox->SetItemDown( nId, true ); @@ -256,7 +245,7 @@ IMPL_LINK(SwTbxAutoTextCtrl, PopupHdl, PopupMenu*, pMenu) OUString sShortName = pGlossaryList->GetBlockShortName(nBlock - 1, nId - (100 * nBlock) - 1); - SwGlossaryHdl* pGlosHdl = pView->GetGlosHdl(); + SwGlossaryHdl* pGlosHdl = ::GetActiveView()->GetGlosHdl(); SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); OSL_ENSURE(pFact, "Dialog creation failed!"); ::GlossarySetActGroup fnSetActGroup = pFact->SetGlossaryActGroupFunc(); commit 6b50523f86fd875bd74ae49ad6b7909ccdafed92 Author: Jan Holesovsky <ke...@collabora.com> Date: Thu Oct 23 08:56:15 2014 +0200 Whitespace (and other) cleanup. Change-Id: I6af10899a3e22c45b973439fd8c8ec6c8faac904 diff --git a/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx b/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx index 36ba1e1..7eb29ab 100644 --- a/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx +++ b/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx @@ -47,8 +47,11 @@ #define DO_NOT_CUSTOM false #define USE_CUSTOM true -namespace svx { namespace sidebar { +#define LSP_POS_GLOBAL_VALUE "Line_Spacing_Pos" +#define LSP_LV_GLOBAL_VALUE "Line_Spacing_Lv" +#define BEGIN_VALUE 28 +using namespace svx::sidebar; ParaLineSpacingControl::ParaLineSpacingControl(vcl::Window* pParent, svx::sidebar::ParaPropertyPanel& rPanel) : PopupControl( pParent,SVX_RES(RID_POPUPPANEL_PARAPAGE_LINESPACING)) @@ -778,6 +781,4 @@ void ParaLineSpacingControl::ExecuteLineSpacing( bool aIsCustom, sal_uInt16 aEnt maLineSpacing.SetNoSelection(); } -}} // end of namespace sidebar - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/sidebar/paragraph/ParaLineSpacingControl.hxx b/svx/source/sidebar/paragraph/ParaLineSpacingControl.hxx index 5f86353..1115298 100644 --- a/svx/source/sidebar/paragraph/ParaLineSpacingControl.hxx +++ b/svx/source/sidebar/paragraph/ParaLineSpacingControl.hxx @@ -30,12 +30,8 @@ #include <editeng/lspcitem.hxx> #include <sfx2/sidebar/EnumContext.hxx> - namespace svx { namespace sidebar { -#define LSP_POS_GLOBAL_VALUE "Line_Spacing_Pos" -#define LSP_LV_GLOBAL_VALUE "Line_Spacing_Lv" -#define BEGIN_VALUE 28 class ParaLineSpacingControl:public svx::sidebar::PopupControl { public: diff --git a/svx/source/sidebar/paragraph/ParaLineSpacingPopup.cxx b/svx/source/sidebar/paragraph/ParaLineSpacingPopup.cxx index 6a98948..e5cae1c 100644 --- a/svx/source/sidebar/paragraph/ParaLineSpacingPopup.cxx +++ b/svx/source/sidebar/paragraph/ParaLineSpacingPopup.cxx @@ -16,6 +16,7 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ + #include "ParaLineSpacingPopup.hxx" #include "ParaLineSpacingControl.hxx" #include <boost/bind.hpp> @@ -23,37 +24,29 @@ namespace svx { namespace sidebar { -ParaLineSpacingPopup::ParaLineSpacingPopup ( - vcl::Window* pParent, - const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator) +ParaLineSpacingPopup::ParaLineSpacingPopup(vcl::Window* pParent, const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator) : Popup( pParent, rControlCreator, - OUString( "Paragraph Line Spacing")) + OUString("Paragraph Line Spacing")) { SetPopupModeEndHandler(::boost::bind(&ParaLineSpacingPopup::PopupModeEndCallback, this)); } - - - -ParaLineSpacingPopup::~ParaLineSpacingPopup (void) +ParaLineSpacingPopup::~ParaLineSpacingPopup() { } - - - -void ParaLineSpacingPopup::Rearrange (SfxItemState currSPState,FieldUnit currMetricUnit,SvxLineSpacingItem* currSPItem,const ::sfx2::sidebar::EnumContext currentContext) +void ParaLineSpacingPopup::Rearrange(SfxItemState currSPState,FieldUnit currMetricUnit,SvxLineSpacingItem* currSPItem,const ::sfx2::sidebar::EnumContext currentContext) { ProvideContainerAndControl(); ParaLineSpacingControl* pControl = dynamic_cast<ParaLineSpacingControl*>(mpControl.get()); if (pControl != NULL) - pControl->Rearrange(currSPState,currMetricUnit, currSPItem,currentContext); + pControl->Rearrange(currSPState, currMetricUnit, currSPItem,currentContext); } -void ParaLineSpacingPopup::PopupModeEndCallback (void) +void ParaLineSpacingPopup::PopupModeEndCallback() { ProvideContainerAndControl(); ParaLineSpacingControl* pControl = dynamic_cast<ParaLineSpacingControl*>(mpControl.get()); @@ -61,20 +54,8 @@ void ParaLineSpacingPopup::PopupModeEndCallback (void) return; pControl->PopupModeEndCallback(); - - /*if( pControl->GetLastCustomState() == SPACING_CLOSE_BY_CUS_EDIT) - { - SvtViewOptions aWinOpt( E_WINDOW, SIDEBAR_SPACING_GLOBAL_VALUE ); - ::com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue > aSeq(1); - aSeq[0].Name = "Spacing"; - aSeq[0].Value <<= ::rtl::OUString( String::CreateFromInt32( pControl->GetLastCustomValue() )); - aWinOpt.SetUserData( aSeq ); - - }*/ } - -} } // end of namespace svx::sidebar - +} } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/sidebar/paragraph/ParaLineSpacingPopup.hxx b/svx/source/sidebar/paragraph/ParaLineSpacingPopup.hxx index 060181d..c331f73 100644 --- a/svx/source/sidebar/paragraph/ParaLineSpacingPopup.hxx +++ b/svx/source/sidebar/paragraph/ParaLineSpacingPopup.hxx @@ -33,14 +33,12 @@ class ParaLineSpacingPopup : public Popup { public : - ParaLineSpacingPopup ( - vcl::Window* pParent, - const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator); - virtual ~ParaLineSpacingPopup (void); + ParaLineSpacingPopup(vcl::Window* pParent, const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator); + virtual ~ParaLineSpacingPopup(); - void Rearrange (SfxItemState currSPState,FieldUnit currMetricUnit,SvxLineSpacingItem* currSPItem ,const ::sfx2::sidebar::EnumContext currentContext); + void Rearrange(SfxItemState currSPState, FieldUnit currMetricUnit, SvxLineSpacingItem* currSPItem, const ::sfx2::sidebar::EnumContext currentContext); private: - void PopupModeEndCallback (void); + void PopupModeEndCallback(); }; } } // end of namespace svx::sidebar commit 27415fd0dc397360ceb21aa678b808611d73fc94 Author: Jan Holesovsky <ke...@collabora.com> Date: Tue Oct 21 14:45:16 2014 +0200 Kill some static OUStrings. Change-Id: Ic06a3b4673446bbadd21f2380c04ec628a6f86a9 diff --git a/framework/source/accelerators/acceleratorconfiguration.cxx b/framework/source/accelerators/acceleratorconfiguration.cxx index 2284d16..be5799d 100644 --- a/framework/source/accelerators/acceleratorconfiguration.cxx +++ b/framework/source/accelerators/acceleratorconfiguration.cxx @@ -48,6 +48,9 @@ #include <unotools/configpaths.hxx> #include <svtools/acceleratorexecute.hxx> +#define PRESET_DEFAULT "default" +#define TARGET_CURRENT "current" + namespace framework { const char CFG_ENTRY_SECONDARY[] = "SecondaryKeys"; @@ -228,10 +231,10 @@ void SAL_CALL XMLBasedAcceleratorConfiguration::reload() css::uno::Reference< css::io::XStream > xStreamNoLang; { SolarMutexGuard g; - xStream = m_aPresetHandler.openTarget(PresetHandler::TARGET_CURRENT(), true); // sal_True => open or create! + xStream = m_aPresetHandler.openTarget(TARGET_CURRENT, true); // sal_True => open or create! try { - xStreamNoLang = m_aPresetHandler.openPreset(PresetHandler::PRESET_DEFAULT(), true); + xStreamNoLang = m_aPresetHandler.openPreset(PRESET_DEFAULT, true); } catch(const css::io::IOException&) {} // does not have to exist } @@ -269,7 +272,7 @@ void SAL_CALL XMLBasedAcceleratorConfiguration::store() css::uno::Reference< css::io::XStream > xStream; { SolarMutexGuard g; - xStream = m_aPresetHandler.openTarget(PresetHandler::TARGET_CURRENT(), true); // sal_True => open or create! + xStream = m_aPresetHandler.openTarget(TARGET_CURRENT, true); // sal_True => open or create! } css::uno::Reference< css::io::XOutputStream > xOut; @@ -295,7 +298,7 @@ void SAL_CALL XMLBasedAcceleratorConfiguration::storeToStorage(const css::uno::R { css::uno::Reference< css::io::XStream > xStream = StorageHolder::openSubStreamWithFallback( xStorage, - PresetHandler::TARGET_CURRENT(), + TARGET_CURRENT, css::embed::ElementModes::READWRITE, false); // False => no fallback from read/write to readonly! css::uno::Reference< css::io::XOutputStream > xOut; @@ -325,7 +328,7 @@ sal_Bool SAL_CALL XMLBasedAcceleratorConfiguration::isReadOnly() css::uno::Reference< css::io::XStream > xStream; { SolarMutexGuard g; - xStream = m_aPresetHandler.openTarget(PresetHandler::TARGET_CURRENT(), true); // sal_True => open or create! + xStream = m_aPresetHandler.openTarget(TARGET_CURRENT, true); // sal_True => open or create! } css::uno::Reference< css::io::XOutputStream > xOut; @@ -364,7 +367,7 @@ throw(css::uno::RuntimeException, std::exception) { { SolarMutexGuard g; - m_aPresetHandler.copyPresetToTarget(PresetHandler::PRESET_DEFAULT(), PresetHandler::TARGET_CURRENT()); + m_aPresetHandler.copyPresetToTarget(PRESET_DEFAULT, TARGET_CURRENT); } reload(); diff --git a/framework/source/accelerators/documentacceleratorconfiguration.cxx b/framework/source/accelerators/documentacceleratorconfiguration.cxx index d0564c5..e99c20b 100644 --- a/framework/source/accelerators/documentacceleratorconfiguration.cxx +++ b/framework/source/accelerators/documentacceleratorconfiguration.cxx @@ -39,6 +39,8 @@ using namespace framework; +#define RESOURCETYPE_ACCELERATOR "accelerator" + namespace { /** @@ -189,7 +191,7 @@ void DocumentAcceleratorConfiguration::fillCache() // open the folder, where the configuration exists m_aPresetHandler.connectToResource( PresetHandler::E_DOCUMENT, - PresetHandler::RESOURCETYPE_ACCELERATOR(), + RESOURCETYPE_ACCELERATOR, OUString(), xDocumentRoot, aLanguageTag); diff --git a/framework/source/accelerators/presethandler.cxx b/framework/source/accelerators/presethandler.cxx index 0a200e3..6396ecf 100644 --- a/framework/source/accelerators/presethandler.cxx +++ b/framework/source/accelerators/presethandler.cxx @@ -46,36 +46,6 @@ static const ::sal_Int32 ID_CORRUPT_UICONFIG_GENERAL = 3; namespace framework { -OUString PresetHandler::PRESET_DEFAULT() -{ - return OUString("default"); -} - -OUString PresetHandler::TARGET_CURRENT() -{ - return OUString("current"); -} - -OUString PresetHandler::RESOURCETYPE_MENUBAR() -{ - return OUString("menubar"); -} - -OUString PresetHandler::RESOURCETYPE_TOOLBAR() -{ - return OUString("toolbar"); -} - -OUString PresetHandler::RESOURCETYPE_ACCELERATOR() -{ - return OUString("accelerator"); -} - -OUString PresetHandler::RESOURCETYPE_STATUSBAR() -{ - return OUString("statusbar"); -} - PresetHandler::PresetHandler(const css::uno::Reference< css::uno::XComponentContext >& xContext) : m_xContext(xContext) , m_eConfigType(E_GLOBAL) diff --git a/framework/source/inc/accelerators/presethandler.hxx b/framework/source/inc/accelerators/presethandler.hxx index f34be57..a692f4d 100644 --- a/framework/source/inc/accelerators/presethandler.hxx +++ b/framework/source/inc/accelerators/presethandler.hxx @@ -51,19 +51,6 @@ namespace framework */ class PresetHandler { - - public: - - static OUString PRESET_DEFAULT(); - static OUString TARGET_CURRENT(); - - static OUString RESOURCETYPE_MENUBAR(); - static OUString RESOURCETYPE_TOOLBAR(); - static OUString RESOURCETYPE_ACCELERATOR(); - static OUString RESOURCETYPE_STATUSBAR(); - - // types - public: /** @short this handler can provide different diff --git a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx index 30ace31..fb7f858 100644 --- a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx +++ b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx @@ -61,6 +61,10 @@ using namespace com::sun::star::container; using namespace com::sun::star::beans; using namespace framework; +#define RESOURCETYPE_MENUBAR "menubar" +#define RESOURCETYPE_TOOLBAR "toolbar" +#define RESOURCETYPE_STATUSBAR "statusbar" + namespace { class ModuleUIConfigurationManager : public cppu::WeakImplHelper3< @@ -882,11 +886,11 @@ ModuleUIConfigurationManager::ModuleUIConfigurationManager( { OUString aResourceType; if ( i == ::com::sun::star::ui::UIElementType::MENUBAR ) - aResourceType = PresetHandler::RESOURCETYPE_MENUBAR(); + aResourceType = RESOURCETYPE_MENUBAR; else if ( i == ::com::sun::star::ui::UIElementType::TOOLBAR ) - aResourceType = PresetHandler::RESOURCETYPE_TOOLBAR(); + aResourceType = RESOURCETYPE_TOOLBAR; else if ( i == ::com::sun::star::ui::UIElementType::STATUSBAR ) - aResourceType = PresetHandler::RESOURCETYPE_STATUSBAR(); + aResourceType = RESOURCETYPE_STATUSBAR; if ( !aResourceType.isEmpty() ) { commit 40043080bc5b51db9614aa06486a520c89b6743b Author: Jan Holesovsky <ke...@collabora.com> Date: Tue Oct 21 14:26:05 2014 +0200 vcl button: Avoid a potential crash. Change-Id: I09d0777ef51045054b8e3bc88aba9fb025e6f9ff diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index e1e70c6..f8fad60 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -2149,19 +2149,22 @@ Image VclBuilder::getCommandImage(const OUString& rCommand, bool bLarge, uno::Reference<frame::XModel> xModel(xController->getModel()); uno::Reference<ui::XUIConfigurationManagerSupplier> xSupplier(xModel, uno::UNO_QUERY); - uno::Reference<ui::XUIConfigurationManager> xDocUICfgMgr(xSupplier->getUIConfigurationManager(), uno::UNO_QUERY); - uno::Reference<ui::XImageManager> xDocImgMgr(xDocUICfgMgr->getImageManager(), uno::UNO_QUERY); + if (xSupplier.is()) + { + uno::Reference<ui::XUIConfigurationManager> xDocUICfgMgr(xSupplier->getUIConfigurationManager(), uno::UNO_QUERY); + uno::Reference<ui::XImageManager> xDocImgMgr(xDocUICfgMgr->getImageManager(), uno::UNO_QUERY); - uno::Sequence< uno::Reference<graphic::XGraphic> > aGraphicSeq; - uno::Sequence<OUString> aImageCmdSeq(1); - aImageCmdSeq[0] = rCommand; + uno::Sequence< uno::Reference<graphic::XGraphic> > aGraphicSeq; + uno::Sequence<OUString> aImageCmdSeq(1); + aImageCmdSeq[0] = rCommand; - aGraphicSeq = xDocImgMgr->getImages( nImageType, aImageCmdSeq ); - uno::Reference<graphic::XGraphic> xGraphic = aGraphicSeq[0]; - Image aImage(xGraphic); + aGraphicSeq = xDocImgMgr->getImages( nImageType, aImageCmdSeq ); + uno::Reference<graphic::XGraphic> xGraphic = aGraphicSeq[0]; + Image aImage(xGraphic); - if (!!aImage) - return aImage; + if (!!aImage) + return aImage; + } } catch (uno::Exception&) { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits