This is an automated email from the ASF dual-hosted git repository. mseidel pushed a commit to branch AOO42X in repository https://gitbox.apache.org/repos/asf/openoffice.git
The following commit(s) were added to refs/heads/AOO42X by this push: new 57a904c9d2 Fixed typos, removed whitespace 57a904c9d2 is described below commit 57a904c9d2d7a282aa411e5e14633a27b80300b3 Author: mseidel <msei...@apache.org> AuthorDate: Sat Sep 17 15:46:45 2022 +0200 Fixed typos, removed whitespace (cherry picked from commit 6e496631967b81de2ca58b050aa221fc91b6c02b) --- .../sidebar/graphic/GraphicPropertyPanel.cxx | 42 ++-- .../sidebar/graphic/GraphicPropertyPanel.hxx | 14 +- main/svx/source/sidebar/tools/ColorControl.cxx | 254 +++++++++++---------- main/svx/source/sidebar/tools/ColorPopup.cxx | 34 +-- 4 files changed, 176 insertions(+), 168 deletions(-) diff --git a/main/svx/source/sidebar/graphic/GraphicPropertyPanel.cxx b/main/svx/source/sidebar/graphic/GraphicPropertyPanel.cxx index 4db319e00a..f17f4ef832 100644 --- a/main/svx/source/sidebar/graphic/GraphicPropertyPanel.cxx +++ b/main/svx/source/sidebar/graphic/GraphicPropertyPanel.cxx @@ -1,5 +1,5 @@ /************************************************************** - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -7,18 +7,20 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * *************************************************************/ + + #include <sfx2/sidebar/ResourceDefinitions.hrc> #include <sfx2/sidebar/Theme.hxx> #include <sfx2/sidebar/ControlFactory.hxx> @@ -53,7 +55,7 @@ GraphicPropertyPanel::GraphicPropertyPanel( const cssu::Reference<css::frame::XFrame>& rxFrame, SfxBindings* pBindings) : Control( - pParent, + pParent, SVX_RES(RID_SIDEBAR_GRAPHIC_PANEL)), mpFtBrightness(new FixedText(this, SVX_RES(FT_BRIGHTNESS))), mpMtrBrightness(new MetricField(this, SVX_RES(MTR_BRIGHTNESS))), @@ -89,22 +91,22 @@ GraphicPropertyPanel::GraphicPropertyPanel( // Setup the grid layouter. maLayouter.GetCell(0,0).SetControl(*mpFtBrightness).SetGridWidth(2); maLayouter.GetCell(1,0).SetControl(*mpMtrBrightness).SetGridWidth(2); - + maLayouter.GetCell(0,3).SetControl(*mpFtContrast).SetGridWidth(2); maLayouter.GetCell(1,3).SetControl(*mpMtrContrast).SetGridWidth(2); - + maLayouter.GetCell(2,0).SetControl(*mpFtColorMode).SetGridWidth(2); maLayouter.GetCell(3,0).SetControl(*mpLBColorMode).SetGridWidth(2); - + maLayouter.GetCell(2,3).SetControl(*mpFtTrans).SetGridWidth(2); maLayouter.GetCell(3,3).SetControl(*mpMtrTrans).SetGridWidth(2); - + maLayouter.GetCell(4,0).SetControl(maImgRed).SetFixedWidth(); maLayouter.GetCell(4,1).SetControl(*mpMtrRed); maLayouter.GetCell(5,0).SetControl(maImgBlue).SetFixedWidth(); maLayouter.GetCell(5,1).SetControl(*mpMtrBlue); - + maLayouter.GetCell(4,3).SetControl(maImgGreen).SetFixedWidth(); maLayouter.GetCell(4,4).SetControl(*mpMtrGreen); maLayouter.GetCell(5,3).SetControl(maImgGamma).SetFixedWidth(); @@ -125,7 +127,7 @@ GraphicPropertyPanel::GraphicPropertyPanel( .SetWeight(1) .SetMinimumWidth(Layouter::MapWidth(*this, MBOX_WIDTH - 10)) .SetRightPadding(Layouter::MapWidth(*this,SECTIONPAGE_MARGIN_HORIZONTAL)); - + // Make controls that display text handle short widths more // graceful. Layouter::PrepareForLayouting(*mpFtBrightness); @@ -304,12 +306,12 @@ GraphicPropertyPanel* GraphicPropertyPanel::Create ( SfxBindings* pBindings) { if (pParent == NULL) - throw lang::IllegalArgumentException(A2S("no parent Window given to GraphicPropertyPanel::Create"), NULL, 0); + throw lang::IllegalArgumentException(A2S("no parent window given to GraphicPropertyPanel::Create"), NULL, 0); if ( ! rxFrame.is()) throw lang::IllegalArgumentException(A2S("no XFrame given to GraphicPropertyPanel::Create"), NULL, 1); if (pBindings == NULL) throw lang::IllegalArgumentException(A2S("no SfxBindings given to GraphicPropertyPanel::Create"), NULL, 2); - + return new GraphicPropertyPanel( pParent, rxFrame, @@ -322,15 +324,15 @@ void GraphicPropertyPanel::DataChanged( const DataChangedEvent& rEvent) { (void)rEvent; - + SetupIcons(); } ////////////////////////////////////////////////////////////////////////////// -void GraphicPropertyPanel::NotifyItemUpdate( - sal_uInt16 nSID, - SfxItemState eState, +void GraphicPropertyPanel::NotifyItemUpdate( + sal_uInt16 nSID, + SfxItemState eState, const SfxPoolItem* pState, const bool bIsEnabled) { @@ -536,9 +538,9 @@ void GraphicPropertyPanel::NotifyItemUpdate( -SfxBindings* GraphicPropertyPanel::GetBindings() -{ - return mpBindings; +SfxBindings* GraphicPropertyPanel::GetBindings() +{ + return mpBindings; } diff --git a/main/svx/source/sidebar/graphic/GraphicPropertyPanel.hxx b/main/svx/source/sidebar/graphic/GraphicPropertyPanel.hxx index 48ee6b49c6..425e65f342 100644 --- a/main/svx/source/sidebar/graphic/GraphicPropertyPanel.hxx +++ b/main/svx/source/sidebar/graphic/GraphicPropertyPanel.hxx @@ -1,5 +1,5 @@ /************************************************************** - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -7,18 +7,20 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * *************************************************************/ + + #ifndef SVX_PROPERTYPANEL_GRAPHICPAGE_HXX #define SVX_PROPERTYPANEL_GRAPHICPAGE_HXX @@ -102,7 +104,7 @@ private: cssu::Reference<css::frame::XFrame> mxFrame; SfxBindings* mpBindings; ::sfx2::sidebar::GridLayouter maLayouter; - + DECL_LINK( ModifyBrightnessHdl, void * ); DECL_LINK( ModifyContrastHdl, void * ); DECL_LINK( ModifyTransHdl, void * ); @@ -113,7 +115,7 @@ private: DECL_LINK( BlueHdl, void*); DECL_LINK( GammaHdl, void*); - // constructor/destuctor + // constructor/destructor GraphicPropertyPanel( Window* pParent, const cssu::Reference<css::frame::XFrame>& rxFrame, diff --git a/main/svx/source/sidebar/tools/ColorControl.cxx b/main/svx/source/sidebar/tools/ColorControl.cxx index 5380db111d..1416cb4556 100644 --- a/main/svx/source/sidebar/tools/ColorControl.cxx +++ b/main/svx/source/sidebar/tools/ColorControl.cxx @@ -1,5 +1,5 @@ /************************************************************** - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -7,18 +7,20 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * *************************************************************/ + + #include "precompiled_svx.hxx" #include <svx/sidebar/ColorControl.hxx> @@ -41,71 +43,71 @@ using ::sfx2::sidebar::Theme; namespace svx { namespace sidebar { namespace { - short GetItemId_Imp( ValueSet& rValueSet, const Color& rCol ) - { - if(rCol == COL_AUTO) - return 0; - - bool bFound = false; - sal_uInt16 nCount = rValueSet.GetItemCount(); - sal_uInt16 n = 1; - - while ( !bFound && n <= nCount ) - { - Color aValCol = rValueSet.GetItemColor(n); - - bFound = ( aValCol.GetRed() == rCol.GetRed() - && aValCol.GetGreen() == rCol.GetGreen() - && aValCol.GetBlue() == rCol.GetBlue() ); - - if ( !bFound ) - n++; - } - return bFound ? n : -1; - } - - const XColorListSharedPtr GetColorTable (void) - { - SfxObjectShell* pDocSh = SfxObjectShell::Current(); - DBG_ASSERT(pDocSh!=NULL, "DocShell not found!"); - if (pDocSh != NULL) - { - const SfxPoolItem* pItem = pDocSh->GetItem(SID_COLOR_TABLE); - if (pItem != NULL) - { - return static_cast< const SvxColorTableItem* >(pItem)->GetColorTable(); - } - } - - return XPropertyListFactory::CreateSharedXColorList(SvtPathOptions().GetPalettePath()); - } + short GetItemId_Imp( ValueSet& rValueSet, const Color& rCol ) + { + if(rCol == COL_AUTO) + return 0; + + bool bFound = false; + sal_uInt16 nCount = rValueSet.GetItemCount(); + sal_uInt16 n = 1; + + while ( !bFound && n <= nCount ) + { + Color aValCol = rValueSet.GetItemColor(n); + + bFound = ( aValCol.GetRed() == rCol.GetRed() + && aValCol.GetGreen() == rCol.GetGreen() + && aValCol.GetBlue() == rCol.GetBlue() ); + + if ( !bFound ) + n++; + } + return bFound ? n : -1; + } + + const XColorListSharedPtr GetColorTable (void) + { + SfxObjectShell* pDocSh = SfxObjectShell::Current(); + DBG_ASSERT(pDocSh!=NULL, "DocShell not found!"); + if (pDocSh != NULL) + { + const SfxPoolItem* pItem = pDocSh->GetItem(SID_COLOR_TABLE); + if (pItem != NULL) + { + return static_cast< const SvxColorTableItem* >(pItem)->GetColorTable(); + } + } + + return XPropertyListFactory::CreateSharedXColorList(SvtPathOptions().GetPalettePath()); + } } // end of anonymous namespace ColorControl::ColorControl ( - Window* pParent, - SfxBindings* pBindings, - const ResId& rControlResId, - const ResId& rValueSetResId, - const ::boost::function<Color(void)>& rNoColorGetter, - const ::boost::function<void(String&,Color)>& rColorSetter, - FloatingWindow* pFloatingWindow, - const ResId* pNoColorStringResId) // const sal_uInt32 nNoColorStringResId) - : PopupControl(pParent, rControlResId), - mpBindings(pBindings), - maVSColor(this, rValueSetResId), - mpFloatingWindow(pFloatingWindow), - msNoColorString( - pNoColorStringResId - ? String(*pNoColorStringResId) - : String()), - maNoColorGetter(rNoColorGetter), - maColorSetter(rColorSetter) + Window* pParent, + SfxBindings* pBindings, + const ResId& rControlResId, + const ResId& rValueSetResId, + const ::boost::function<Color(void)>& rNoColorGetter, + const ::boost::function<void(String&,Color)>& rColorSetter, + FloatingWindow* pFloatingWindow, + const ResId* pNoColorStringResId) // const sal_uInt32 nNoColorStringResId) + : PopupControl(pParent, rControlResId), + mpBindings(pBindings), + maVSColor(this, rValueSetResId), + mpFloatingWindow(pFloatingWindow), + msNoColorString( + pNoColorStringResId + ? String(*pNoColorStringResId) + : String()), + maNoColorGetter(rNoColorGetter), + maColorSetter(rColorSetter) { FreeResource(); - FillColors(); + FillColors(); } @@ -121,37 +123,37 @@ void ColorControl::FillColors (void) { const XColorListSharedPtr aColorTable(GetColorTable()); - const long nColorCount(aColorTable->Count()); - if (nColorCount <= 0) - return; + const long nColorCount(aColorTable->Count()); + if (nColorCount <= 0) + return; - const WinBits aWinBits(maVSColor.GetStyle() | WB_TABSTOP | WB_ITEMBORDER | WB_NAMEFIELD | - WB_NO_DIRECTSELECT | WB_MENUSTYLEVALUESET | WB_NO_DIRECTSELECT); + const WinBits aWinBits(maVSColor.GetStyle() | WB_TABSTOP | WB_ITEMBORDER | WB_NAMEFIELD | + WB_NO_DIRECTSELECT | WB_MENUSTYLEVALUESET | WB_NO_DIRECTSELECT); - maVSColor.SetStyle(aWinBits); + maVSColor.SetStyle(aWinBits); - // neds to be done *before* layouting - if(msNoColorString.Len() > 0) - { - maVSColor.SetStyle(maVSColor.GetStyle() | WB_NONEFIELD); - maVSColor.SetText(msNoColorString); - } + // needs to be done *before* layouting + if(msNoColorString.Len() > 0) + { + maVSColor.SetStyle(maVSColor.GetStyle() | WB_NONEFIELD); + maVSColor.SetText(msNoColorString); + } - const Size aNewSize(maVSColor.layoutAllVisible(nColorCount)); - maVSColor.SetOutputSizePixel(aNewSize); - static sal_Int32 nAdd = 4; + const Size aNewSize(maVSColor.layoutAllVisible(nColorCount)); + maVSColor.SetOutputSizePixel(aNewSize); + static sal_Int32 nAdd = 4; - SetOutputSizePixel(Size(aNewSize.Width() + nAdd, aNewSize.Height() + nAdd)); - Link aLink = LINK(this, ColorControl, VSSelectHdl); - maVSColor.SetSelectHdl(aLink); + SetOutputSizePixel(Size(aNewSize.Width() + nAdd, aNewSize.Height() + nAdd)); + Link aLink = LINK(this, ColorControl, VSSelectHdl); + maVSColor.SetSelectHdl(aLink); - // Now, after all calls to SetStyle, we can change the - // background color. - maVSColor.SetBackground(Theme::GetWallpaper(Theme::Paint_DropDownBackground)); + // Now, after all calls to SetStyle, we can change the + // background color. + maVSColor.SetBackground(Theme::GetWallpaper(Theme::Paint_DropDownBackground)); - // add entrties - maVSColor.Clear(); - maVSColor.addEntriesForXColorList(aColorTable); + // add entries + maVSColor.Clear(); + maVSColor.addEntriesForXColorList(aColorTable); maVSColor.Show(); } @@ -169,27 +171,27 @@ void ColorControl::GetFocus (void) void ColorControl::SetCurColorSelect(Color aCol,bool bAvailable) { - //UUUU When transparent use transparent entry (entry 0) - const bool bIsTransparent(0xff == aCol.GetTransparency()); - short nCol = bIsTransparent ? 0 : GetItemId_Imp(maVSColor,aCol); - - if(!bAvailable) - { - maVSColor.SetNoSelection(); - return; - } - - //if not found - if(nCol == -1) - { - maVSColor.SetNoSelection(); - } - else - { - // remove selection first to force evtl. scroll when scroll is needed - maVSColor.SetNoSelection(); - maVSColor.SelectItem(nCol); - } + // UUUU When transparent use transparent entry (entry 0) + const bool bIsTransparent(0xff == aCol.GetTransparency()); + short nCol = bIsTransparent ? 0 : GetItemId_Imp(maVSColor,aCol); + + if(!bAvailable) + { + maVSColor.SetNoSelection(); + return; + } + + // if not found + if(nCol == -1) + { + maVSColor.SetNoSelection(); + } + else + { + // remove selection first to force evtl. scroll when scroll is needed + maVSColor.SetNoSelection(); + maVSColor.SelectItem(nCol); + } } @@ -197,26 +199,26 @@ void ColorControl::SetCurColorSelect(Color aCol,bool bAvailable) IMPL_LINK(ColorControl, VSSelectHdl, void *, pControl) { - if(pControl == &maVSColor) - { - sal_uInt16 iPos = maVSColor.GetSelectItemId(); - Color aColor = maVSColor.GetItemColor( iPos ); - String aTmpStr = maVSColor.GetItemText( iPos ); - - // react when the WB_NONEFIELD created entry is selected - if (aColor.GetColor() == 0 && aTmpStr.Equals(String::CreateFromAscii(""))) - { - if (maNoColorGetter) - aColor = maNoColorGetter(); - } - if (maColorSetter) - maColorSetter(aTmpStr, aColor); - - if (mpFloatingWindow!=NULL && mpFloatingWindow->IsInPopupMode()) - mpFloatingWindow->EndPopupMode(); - } - - return 0; + if(pControl == &maVSColor) + { + sal_uInt16 iPos = maVSColor.GetSelectItemId(); + Color aColor = maVSColor.GetItemColor( iPos ); + String aTmpStr = maVSColor.GetItemText( iPos ); + + // react when the WB_NONEFIELD created entry is selected + if (aColor.GetColor() == 0 && aTmpStr.Equals(String::CreateFromAscii(""))) + { + if (maNoColorGetter) + aColor = maNoColorGetter(); + } + if (maColorSetter) + maColorSetter(aTmpStr, aColor); + + if (mpFloatingWindow!=NULL && mpFloatingWindow->IsInPopupMode()) + mpFloatingWindow->EndPopupMode(); + } + + return 0; } diff --git a/main/svx/source/sidebar/tools/ColorPopup.cxx b/main/svx/source/sidebar/tools/ColorPopup.cxx index dc3446fa59..2dbd795744 100644 --- a/main/svx/source/sidebar/tools/ColorPopup.cxx +++ b/main/svx/source/sidebar/tools/ColorPopup.cxx @@ -1,5 +1,5 @@ /************************************************************** - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -7,18 +7,20 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * *************************************************************/ + + #include <svx/sidebar/ColorPopup.hxx> #include <svx/sidebar/ColorControl.hxx> @@ -26,12 +28,12 @@ namespace svx { namespace sidebar { ColorPopup::ColorPopup ( - Window* pParent, - const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator) - : Popup( - pParent, - rControlCreator, - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Color"))) + Window* pParent, + const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator) + : Popup( + pParent, + rControlCreator, + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Color"))) { } @@ -46,14 +48,14 @@ ColorPopup::~ColorPopup (void) void ColorPopup::SetCurrentColor ( - const Color aCurrentColor, - const bool bIsColorAvailable) + const Color aCurrentColor, + const bool bIsColorAvailable) { - ProvideContainerAndControl(); + ProvideContainerAndControl(); - ColorControl* pColorControl = dynamic_cast<ColorControl*>(mpControl.get()); - if (pColorControl != NULL) - pColorControl->SetCurColorSelect(aCurrentColor, bIsColorAvailable); + ColorControl* pColorControl = dynamic_cast<ColorControl*>(mpControl.get()); + if (pColorControl != NULL) + pColorControl->SetCurColorSelect(aCurrentColor, bIsColorAvailable); }