1f6e50924SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3f6e50924SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4f6e50924SAndrew Rist * or more contributor license agreements. See the NOTICE file 5f6e50924SAndrew Rist * distributed with this work for additional information 6f6e50924SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7f6e50924SAndrew Rist * to you under the Apache License, Version 2.0 (the 8f6e50924SAndrew Rist * "License"); you may not use this file except in compliance 9f6e50924SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11f6e50924SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13f6e50924SAndrew Rist * Unless required by applicable law or agreed to in writing, 14f6e50924SAndrew Rist * software distributed under the License is distributed on an 15f6e50924SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16f6e50924SAndrew Rist * KIND, either express or implied. See the License for the 17f6e50924SAndrew Rist * specific language governing permissions and limitations 18f6e50924SAndrew Rist * under the License. 19cdf0e10cSrcweir * 20f6e50924SAndrew Rist *************************************************************/ 21f6e50924SAndrew Rist 22f6e50924SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_svx.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <com/sun/star/text/WritingMode.hpp> 28cdf0e10cSrcweir 29cdf0e10cSrcweir #include <vcl/toolbox.hxx> 30cdf0e10cSrcweir 31cdf0e10cSrcweir #include <svl/itempool.hxx> 32cdf0e10cSrcweir 33cdf0e10cSrcweir #include <svtools/toolbarmenu.hxx> 34cdf0e10cSrcweir #include <svtools/popupwindowcontroller.hxx> 35cdf0e10cSrcweir #include <svtools/popupmenucontrollerbase.hxx> 36cdf0e10cSrcweir 37cdf0e10cSrcweir #include <sfx2/app.hxx> 38cdf0e10cSrcweir #include <sfx2/dispatch.hxx> 39cdf0e10cSrcweir 40cdf0e10cSrcweir #include <editeng/eeitem.hxx> 41cdf0e10cSrcweir #include <editeng/frmdiritem.hxx> 42cdf0e10cSrcweir 43cdf0e10cSrcweir #include <svx/fmmodel.hxx> 44cdf0e10cSrcweir #include <svx/svxids.hrc> 45cdf0e10cSrcweir #include <svx/dialmgr.hxx> 46cdf0e10cSrcweir #include <svx/dialogs.hrc> 47cdf0e10cSrcweir #include <svx/svdpage.hxx> 48cdf0e10cSrcweir #include <svx/svdobj.hxx> 49cdf0e10cSrcweir #include <svx/svdview.hxx> 50cdf0e10cSrcweir #include <svx/svdoutl.hxx> 51cdf0e10cSrcweir 52cdf0e10cSrcweir #include "svx/gallery.hxx" 53cdf0e10cSrcweir #include <svx/dlgutil.hxx> 54cdf0e10cSrcweir 55cdf0e10cSrcweir #include <svx/fontworkgallery.hxx> 56cdf0e10cSrcweir #include "fontworkgallery.hrc" 57cdf0e10cSrcweir 58cdf0e10cSrcweir #include <algorithm> 59cdf0e10cSrcweir 60cdf0e10cSrcweir #include "helpid.hrc" 61cdf0e10cSrcweir 62cdf0e10cSrcweir using ::rtl::OUString; 63cdf0e10cSrcweir using ::svtools::ToolbarMenu; 64cdf0e10cSrcweir 65cdf0e10cSrcweir using namespace ::com::sun::star; 66cdf0e10cSrcweir using namespace ::com::sun::star::uno; 67cdf0e10cSrcweir using namespace ::com::sun::star::lang; 68cdf0e10cSrcweir using namespace ::com::sun::star::beans; 69cdf0e10cSrcweir using namespace ::com::sun::star::frame; 70cdf0e10cSrcweir 71cdf0e10cSrcweir namespace svx 72cdf0e10cSrcweir { 73cdf0e10cSrcweir 74cdf0e10cSrcweir const int nColCount = 4; 75cdf0e10cSrcweir const int nLineCount = 4; 76cdf0e10cSrcweir 77cdf0e10cSrcweir /************************************************************************* 78cdf0e10cSrcweir |* Svx3DWin - FloatingWindow 79cdf0e10cSrcweir \************************************************************************/ 80cdf0e10cSrcweir FontWorkGalleryDialog::FontWorkGalleryDialog( SdrView* pSdrView, Window* pParent, sal_uInt16 /*nSID*/ ) : 81cdf0e10cSrcweir ModalDialog( pParent, SVX_RES( RID_SVX_MDLG_FONTWORK_GALLERY ) ), 82cdf0e10cSrcweir maFLFavorites ( this, SVX_RES( FL_FAVORITES ) ), 83cdf0e10cSrcweir maCtlFavorites ( this, SVX_RES( CTL_FAVORITES ) ), 84cdf0e10cSrcweir maOKButton ( this, SVX_RES( BTN_OK ) ), 85cdf0e10cSrcweir maCancelButton ( this, SVX_RES( BTN_CANCEL ) ), 86cdf0e10cSrcweir maHelpButton ( this, SVX_RES( BTN_HELP ) ), 87cdf0e10cSrcweir mnThemeId ( 0xffff ), 88cdf0e10cSrcweir mpSdrView ( pSdrView ), 89cdf0e10cSrcweir mpModel ( (FmFormModel*)pSdrView->GetModel() ), 90cdf0e10cSrcweir maStrClickToAddText ( SVX_RES( STR_CLICK_TO_ADD_TEXT ) ), 91cdf0e10cSrcweir mppSdrObject ( NULL ), 92cdf0e10cSrcweir mpDestModel ( NULL ) 93cdf0e10cSrcweir { 94cdf0e10cSrcweir FreeResource(); 95cdf0e10cSrcweir 96cdf0e10cSrcweir maCtlFavorites.SetDoubleClickHdl( LINK( this, FontWorkGalleryDialog, DoubleClickFavoriteHdl ) ); 97cdf0e10cSrcweir maOKButton.SetClickHdl( LINK( this, FontWorkGalleryDialog, ClickOKHdl ) ); 98cdf0e10cSrcweir 99cdf0e10cSrcweir maCtlFavorites.SetColCount( nColCount ); 100cdf0e10cSrcweir maCtlFavorites.SetLineCount( nLineCount ); 101cdf0e10cSrcweir maCtlFavorites.SetExtraSpacing( 3 ); 102cdf0e10cSrcweir 103cdf0e10cSrcweir initfavorites( GALLERY_THEME_FONTWORK, maFavoritesHorizontal ); 104cdf0e10cSrcweir fillFavorites( GALLERY_THEME_FONTWORK, maFavoritesHorizontal ); 105cdf0e10cSrcweir } 106cdf0e10cSrcweir 107cdf0e10cSrcweir static void delete_bitmap( Bitmap* p ) { delete p; } 108cdf0e10cSrcweir 109cdf0e10cSrcweir // ----------------------------------------------------------------------- 110cdf0e10cSrcweir FontWorkGalleryDialog::~FontWorkGalleryDialog() 111cdf0e10cSrcweir { 112cdf0e10cSrcweir std::for_each( maFavoritesHorizontal.begin(), maFavoritesHorizontal.end(), delete_bitmap ); 113cdf0e10cSrcweir } 114cdf0e10cSrcweir 115cdf0e10cSrcweir // ----------------------------------------------------------------------- 116cdf0e10cSrcweir 117cdf0e10cSrcweir void FontWorkGalleryDialog::initfavorites(sal_uInt16 nThemeId, std::vector< Bitmap * >& rFavorites) 118cdf0e10cSrcweir { 119cdf0e10cSrcweir // Ueber die Gallery werden die Favoriten eingelesen 120cdf0e10cSrcweir sal_uIntPtr nFavCount = GalleryExplorer::GetSdrObjCount( nThemeId ); 121cdf0e10cSrcweir 122cdf0e10cSrcweir // Gallery thema locken 123cdf0e10cSrcweir GalleryExplorer::BeginLocking(nThemeId); 124cdf0e10cSrcweir 125cdf0e10cSrcweir sal_uInt32 nModelPos; 126cdf0e10cSrcweir FmFormModel *pModel = NULL; 127cdf0e10cSrcweir for( nModelPos = 0; nModelPos < nFavCount; nModelPos++ ) 128cdf0e10cSrcweir { 129cdf0e10cSrcweir Bitmap* pThumb = new Bitmap; 130cdf0e10cSrcweir 131cdf0e10cSrcweir if( GalleryExplorer::GetSdrObj( nThemeId, nModelPos, pModel, pThumb ) ) 132cdf0e10cSrcweir { 133cdf0e10cSrcweir /* 134cdf0e10cSrcweir VirtualDevice aVDev; 135cdf0e10cSrcweir Size aRenderSize( aThumbSize.Width() * 4, aThumbSize.Height() * 4 ); 136cdf0e10cSrcweir aVDev.SetOutputSizePixel( aRenderSize ); 137cdf0e10cSrcweir 138cdf0e10cSrcweir if( GalleryExplorer::DrawCentered( &aVDev, *pModel ) ) 139cdf0e10cSrcweir { 140cdf0e10cSrcweir aThumb = aVDev.GetBitmap( Point(), aVDev.GetOutputSizePixel() ); 141cdf0e10cSrcweir 142cdf0e10cSrcweir Size aMS( 4, 4 ); 143cdf0e10cSrcweir BmpFilterParam aParam( aMS ); 144cdf0e10cSrcweir aThumb.Filter( BMP_FILTER_MOSAIC, &aParam ); 145cdf0e10cSrcweir aThumb.Scale( aThumbSize ); 146cdf0e10cSrcweir } 147cdf0e10cSrcweir */ 148cdf0e10cSrcweir } 149cdf0e10cSrcweir 150cdf0e10cSrcweir rFavorites.push_back( pThumb ); 151cdf0e10cSrcweir } 152cdf0e10cSrcweir 153cdf0e10cSrcweir // Gallery thema freigeben 154cdf0e10cSrcweir GalleryExplorer::EndLocking(nThemeId); 155cdf0e10cSrcweir } 156cdf0e10cSrcweir 157cdf0e10cSrcweir void FontWorkGalleryDialog::fillFavorites( sal_uInt16 nThemeId, std::vector< Bitmap * >& rFavorites ) 158cdf0e10cSrcweir { 159cdf0e10cSrcweir mnThemeId = nThemeId; 160cdf0e10cSrcweir 161cdf0e10cSrcweir Size aThumbSize( maCtlFavorites.GetSizePixel() ); 162cdf0e10cSrcweir aThumbSize.Width() /= nColCount; 163cdf0e10cSrcweir aThumbSize.Height() /= nLineCount; 164cdf0e10cSrcweir aThumbSize.Width() -= 12; 165cdf0e10cSrcweir aThumbSize.Height() -= 12; 166cdf0e10cSrcweir 167cdf0e10cSrcweir std::vector< Bitmap * >::size_type nFavCount = rFavorites.size(); 168cdf0e10cSrcweir 169cdf0e10cSrcweir // ValueSet Favoriten 170cdf0e10cSrcweir if( nFavCount > (nColCount * nLineCount) ) 171cdf0e10cSrcweir { 172cdf0e10cSrcweir WinBits nWinBits = maCtlFavorites.GetStyle(); 173cdf0e10cSrcweir nWinBits |= WB_VSCROLL; 174cdf0e10cSrcweir maCtlFavorites.SetStyle( nWinBits ); 175cdf0e10cSrcweir } 176cdf0e10cSrcweir 177cdf0e10cSrcweir maCtlFavorites.Clear(); 178cdf0e10cSrcweir 179cdf0e10cSrcweir sal_uInt32 nFavorite; 180cdf0e10cSrcweir for( nFavorite = 1; nFavorite <= nFavCount; nFavorite++ ) 181cdf0e10cSrcweir { 182cdf0e10cSrcweir String aStr(SVX_RES(RID_SVXFLOAT3D_FAVORITE)); 183cdf0e10cSrcweir aStr += sal_Unicode(' '); 184cdf0e10cSrcweir aStr += String::CreateFromInt32((sal_Int32)nFavorite); 185cdf0e10cSrcweir Image aThumbImage( *rFavorites[nFavorite-1] ); 186cdf0e10cSrcweir maCtlFavorites.InsertItem( (sal_uInt16)nFavorite, aThumbImage, aStr ); 187cdf0e10cSrcweir } 188cdf0e10cSrcweir } 189cdf0e10cSrcweir 190cdf0e10cSrcweir void FontWorkGalleryDialog::changeText( SdrTextObj* pObj ) 191cdf0e10cSrcweir { 192cdf0e10cSrcweir if( pObj ) 193cdf0e10cSrcweir { 194cdf0e10cSrcweir SdrOutliner& rOutl = mpModel->GetDrawOutliner(pObj); 195cdf0e10cSrcweir 196cdf0e10cSrcweir sal_uInt16 nOutlMode = rOutl.GetMode(); 197cdf0e10cSrcweir Size aPaperSize = rOutl.GetPaperSize(); 198cdf0e10cSrcweir sal_Bool bUpdateMode = rOutl.GetUpdateMode(); 199cdf0e10cSrcweir rOutl.SetUpdateMode(sal_False); 200cdf0e10cSrcweir rOutl.SetParaAttribs( 0, rOutl.GetEmptyItemSet() ); 201cdf0e10cSrcweir 202cdf0e10cSrcweir // #95114# Always set the object's StyleSheet at the Outliner to 203cdf0e10cSrcweir // use the current objects StyleSheet. Thus it's the same as in 204cdf0e10cSrcweir // SetText(...). 205cdf0e10cSrcweir // #95114# Moved this implementation from where SetObjText(...) was called 206cdf0e10cSrcweir // to inside this method to work even when outliner is fetched here. 207cdf0e10cSrcweir rOutl.SetStyleSheet(0, pObj->GetStyleSheet()); 208cdf0e10cSrcweir 209cdf0e10cSrcweir rOutl.SetPaperSize( pObj->GetLogicRect().GetSize() ); 210cdf0e10cSrcweir 211cdf0e10cSrcweir rOutl.SetText( maStrClickToAddText, rOutl.GetParagraph( 0 ) ); 212cdf0e10cSrcweir pObj->SetOutlinerParaObject( rOutl.CreateParaObject() ); 213cdf0e10cSrcweir 214cdf0e10cSrcweir rOutl.Init( nOutlMode ); 215cdf0e10cSrcweir rOutl.SetParaAttribs( 0, rOutl.GetEmptyItemSet() ); 216cdf0e10cSrcweir rOutl.SetUpdateMode( bUpdateMode ); 217cdf0e10cSrcweir rOutl.SetPaperSize( aPaperSize ); 218cdf0e10cSrcweir 219cdf0e10cSrcweir rOutl.Clear(); 220cdf0e10cSrcweir } 221cdf0e10cSrcweir } 222cdf0e10cSrcweir 223cdf0e10cSrcweir void FontWorkGalleryDialog::SetSdrObjectRef( SdrObject** ppSdrObject, SdrModel* pModel ) 224cdf0e10cSrcweir { 225cdf0e10cSrcweir mppSdrObject = ppSdrObject; 226cdf0e10cSrcweir mpDestModel = pModel; 227cdf0e10cSrcweir } 228cdf0e10cSrcweir 229cdf0e10cSrcweir void FontWorkGalleryDialog::insertSelectedFontwork() 230cdf0e10cSrcweir { 231cdf0e10cSrcweir sal_uInt16 nItemId = maCtlFavorites.GetSelectItemId(); 232cdf0e10cSrcweir 233cdf0e10cSrcweir if( nItemId > 0 ) 234cdf0e10cSrcweir { 235cdf0e10cSrcweir FmFormModel* pModel = new FmFormModel(); 236cdf0e10cSrcweir pModel->GetItemPool().FreezeIdRanges(); 237cdf0e10cSrcweir 238cdf0e10cSrcweir if( GalleryExplorer::GetSdrObj( mnThemeId, nItemId-1, pModel ) ) 239cdf0e10cSrcweir { 240cdf0e10cSrcweir SdrPage* pPage = pModel->GetPage(0); 241cdf0e10cSrcweir if( pPage && pPage->GetObjCount() ) 242cdf0e10cSrcweir { 243cdf0e10cSrcweir SdrObject* pNewObject = pPage->GetObj(0)->Clone(); 244cdf0e10cSrcweir 245cdf0e10cSrcweir // center shape on current view 246cdf0e10cSrcweir OutputDevice* pOutDev = mpSdrView->GetFirstOutputDevice(); 247cdf0e10cSrcweir if( pOutDev ) 248cdf0e10cSrcweir { 249cdf0e10cSrcweir Rectangle aObjRect( pNewObject->GetLogicRect() ); 250cdf0e10cSrcweir Rectangle aVisArea = pOutDev->PixelToLogic(Rectangle(Point(0,0), pOutDev->GetOutputSizePixel())); 251cdf0e10cSrcweir /* 252cdf0e10cSrcweir sal_Int32 nObjHeight = aObjRect.GetHeight(); 253cdf0e10cSrcweir VirtualDevice aVirDev( 1 ); // calculating the optimal textwidth 254cdf0e10cSrcweir Font aFont; 255cdf0e10cSrcweir aFont.SetHeight( nObjHeight ); 256cdf0e10cSrcweir aVirDev.SetMapMode( MAP_100TH_MM ); 257cdf0e10cSrcweir aVirDev.SetFont( aFont ); 258cdf0e10cSrcweir aObjRect.SetSize( Size( aVirDev.GetTextWidth( maStrClickToAddText ), nObjHeight ) ); 259cdf0e10cSrcweir */ 260cdf0e10cSrcweir Point aPagePos = aVisArea.Center(); 261cdf0e10cSrcweir aPagePos.X() -= aObjRect.GetWidth() / 2; 262cdf0e10cSrcweir aPagePos.Y() -= aObjRect.GetHeight() / 2; 263cdf0e10cSrcweir Rectangle aNewObjectRectangle(aPagePos, aObjRect.GetSize()); 264cdf0e10cSrcweir SdrPageView* pPV = mpSdrView->GetSdrPageView(); 265cdf0e10cSrcweir 266cdf0e10cSrcweir pNewObject->SetLogicRect(aNewObjectRectangle); 267cdf0e10cSrcweir if ( mppSdrObject ) 268cdf0e10cSrcweir { 269cdf0e10cSrcweir *mppSdrObject = pNewObject; 270cdf0e10cSrcweir (*mppSdrObject)->SetModel( mpDestModel ); 271cdf0e10cSrcweir } 272cdf0e10cSrcweir else if( pPV ) 273cdf0e10cSrcweir { 274cdf0e10cSrcweir mpSdrView->InsertObjectAtView( pNewObject, *pPV ); 275cdf0e10cSrcweir // changeText( PTR_CAST( SdrTextObj, pNewObject ) ); 276cdf0e10cSrcweir } 277cdf0e10cSrcweir } 278cdf0e10cSrcweir } 279cdf0e10cSrcweir } 280cdf0e10cSrcweir 281cdf0e10cSrcweir delete pModel; 282cdf0e10cSrcweir } 283cdf0e10cSrcweir } 284cdf0e10cSrcweir 285cdf0e10cSrcweir // ----------------------------------------------------------------------- 286cdf0e10cSrcweir 287cdf0e10cSrcweir IMPL_LINK( FontWorkGalleryDialog, ClickOKHdl, void*, EMPTYARG ) 288cdf0e10cSrcweir { 289cdf0e10cSrcweir insertSelectedFontwork(); 290cdf0e10cSrcweir EndDialog( true ); 291cdf0e10cSrcweir return 0; 292cdf0e10cSrcweir } 293cdf0e10cSrcweir 294cdf0e10cSrcweir // ----------------------------------------------------------------------- 295cdf0e10cSrcweir 296cdf0e10cSrcweir IMPL_LINK( FontWorkGalleryDialog, DoubleClickFavoriteHdl, void*, EMPTYARG ) 297cdf0e10cSrcweir { 298cdf0e10cSrcweir insertSelectedFontwork(); 299cdf0e10cSrcweir EndDialog( true ); 300cdf0e10cSrcweir return( 0L ); 301cdf0e10cSrcweir } 302cdf0e10cSrcweir 303cdf0e10cSrcweir //------------------------------------------------------------------------ 304cdf0e10cSrcweir 305cdf0e10cSrcweir SFX_IMPL_TOOLBOX_CONTROL( FontWorkShapeTypeControl, SfxStringItem ); 306cdf0e10cSrcweir FontWorkShapeTypeControl::FontWorkShapeTypeControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox &rTbx ) 307cdf0e10cSrcweir : SfxToolBoxControl( nSlotId, nId, rTbx ) 308cdf0e10cSrcweir { 309cdf0e10cSrcweir rTbx.SetItemBits( nId, TIB_DROPDOWNONLY | rTbx.GetItemBits( nId ) ); 310cdf0e10cSrcweir rTbx.Invalidate(); 311cdf0e10cSrcweir } 312cdf0e10cSrcweir 313cdf0e10cSrcweir // ----------------------------------------------------------------------- 314cdf0e10cSrcweir 315cdf0e10cSrcweir FontWorkShapeTypeControl::~FontWorkShapeTypeControl() 316cdf0e10cSrcweir { 317cdf0e10cSrcweir } 318cdf0e10cSrcweir 319cdf0e10cSrcweir // ----------------------------------------------------------------------- 320cdf0e10cSrcweir 321cdf0e10cSrcweir SfxPopupWindowType FontWorkShapeTypeControl::GetPopupWindowType() const 322cdf0e10cSrcweir { 323cdf0e10cSrcweir return SFX_POPUPWINDOW_ONCLICK; //( aLastAction.getLength() == 0 ? SFX_POPUPWINDOW_ONCLICK : SFX_POPUPWINDOW_ONTIMEOUT ); 324cdf0e10cSrcweir } 325cdf0e10cSrcweir 326cdf0e10cSrcweir // ----------------------------------------------------------------------- 327cdf0e10cSrcweir 328cdf0e10cSrcweir SfxPopupWindow* FontWorkShapeTypeControl::CreatePopupWindow() 329cdf0e10cSrcweir { 330cdf0e10cSrcweir rtl::OUString aSubTbxResName( RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolbar/fontworkshapetype" ) ); 331cdf0e10cSrcweir createAndPositionSubToolBar( aSubTbxResName ); 332cdf0e10cSrcweir return NULL; 333cdf0e10cSrcweir } 334cdf0e10cSrcweir 335cdf0e10cSrcweir // ----------------------------------------------------------------------- 336cdf0e10cSrcweir 337cdf0e10cSrcweir void FontWorkShapeTypeControl::Select( sal_Bool ) 338cdf0e10cSrcweir { 339cdf0e10cSrcweir 340cdf0e10cSrcweir } 341cdf0e10cSrcweir 342cdf0e10cSrcweir // ======================================================================== 343*199633b5SHerbert Dürr // FontworkAlignmentWindow 344cdf0e10cSrcweir // ======================================================================== 345cdf0e10cSrcweir 346*199633b5SHerbert Dürr class FontworkAlignmentWindow : public ToolbarMenu 347cdf0e10cSrcweir { 348cdf0e10cSrcweir public: 349*199633b5SHerbert Dürr FontworkAlignmentWindow( svt::ToolboxController& rController, const Reference< XFrame >& rFrame, Window* pParentWindow ); 350cdf0e10cSrcweir 351cdf0e10cSrcweir virtual void SAL_CALL statusChanged( const frame::FeatureStateEvent& Event ) throw ( RuntimeException ); 352cdf0e10cSrcweir virtual void DataChanged( const DataChangedEvent& rDCEvt ); 353cdf0e10cSrcweir 354cdf0e10cSrcweir private: 355cdf0e10cSrcweir svt::ToolboxController& mrController; 356cdf0e10cSrcweir 357cdf0e10cSrcweir Image maImgAlgin1; 358cdf0e10cSrcweir Image maImgAlgin2; 359cdf0e10cSrcweir Image maImgAlgin3; 360cdf0e10cSrcweir Image maImgAlgin4; 361cdf0e10cSrcweir Image maImgAlgin5; 362cdf0e10cSrcweir Image maImgAlgin1h; 363cdf0e10cSrcweir Image maImgAlgin2h; 364cdf0e10cSrcweir Image maImgAlgin3h; 365cdf0e10cSrcweir Image maImgAlgin4h; 366cdf0e10cSrcweir Image maImgAlgin5h; 367cdf0e10cSrcweir 368cdf0e10cSrcweir const rtl::OUString msFontworkAlignment; 369cdf0e10cSrcweir 370cdf0e10cSrcweir DECL_LINK( SelectHdl, void * ); 371cdf0e10cSrcweir 372cdf0e10cSrcweir void implSetAlignment( int nAlignmentMode, bool bEnabled ); 373cdf0e10cSrcweir }; 374cdf0e10cSrcweir 375*199633b5SHerbert Dürr FontworkAlignmentWindow::FontworkAlignmentWindow( svt::ToolboxController& rController, const Reference< XFrame >& rFrame, Window* pParentWindow ) 376cdf0e10cSrcweir : ToolbarMenu( rFrame, pParentWindow, SVX_RES( RID_SVXFLOAT_FONTWORK_ALIGNMENT )) 377cdf0e10cSrcweir , mrController( rController ) 378cdf0e10cSrcweir , maImgAlgin1( SVX_RES( IMG_FONTWORK_ALIGN_LEFT_16 ) ) 379cdf0e10cSrcweir , maImgAlgin2( SVX_RES( IMG_FONTWORK_ALIGN_CENTER_16 ) ) 380cdf0e10cSrcweir , maImgAlgin3( SVX_RES( IMG_FONTWORK_ALIGN_RIGHT_16 ) ) 381cdf0e10cSrcweir , maImgAlgin4( SVX_RES( IMG_FONTWORK_ALIGN_WORD_16 ) ) 382cdf0e10cSrcweir , maImgAlgin5( SVX_RES( IMG_FONTWORK_ALIGN_STRETCH_16 ) ) 383cdf0e10cSrcweir , maImgAlgin1h( SVX_RES( IMG_FONTWORK_ALIGN_LEFT_16_H ) ) 384cdf0e10cSrcweir , maImgAlgin2h( SVX_RES( IMG_FONTWORK_ALIGN_CENTER_16_H ) ) 385cdf0e10cSrcweir , maImgAlgin3h( SVX_RES( IMG_FONTWORK_ALIGN_RIGHT_16_H ) ) 386cdf0e10cSrcweir , maImgAlgin4h( SVX_RES( IMG_FONTWORK_ALIGN_WORD_16_H ) ) 387cdf0e10cSrcweir , maImgAlgin5h( SVX_RES( IMG_FONTWORK_ALIGN_STRETCH_16_H ) ) 388cdf0e10cSrcweir , msFontworkAlignment( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontworkAlignment" ) ) 389cdf0e10cSrcweir { 390cdf0e10cSrcweir bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); 391cdf0e10cSrcweir 392cdf0e10cSrcweir SetHelpId( HID_POPUP_FONTWORK_ALIGN ); 393*199633b5SHerbert Dürr SetSelectHdl( LINK( this, FontworkAlignmentWindow, SelectHdl ) ); 394cdf0e10cSrcweir 395cdf0e10cSrcweir appendEntry( 0, String( SVX_RES( STR_ALIGN_LEFT ) ), bHighContrast ? maImgAlgin1h : maImgAlgin1 ); 396cdf0e10cSrcweir appendEntry( 1, String( SVX_RES( STR_ALIGN_CENTER ) ), bHighContrast ? maImgAlgin2h : maImgAlgin2 ); 397cdf0e10cSrcweir appendEntry( 2, String( SVX_RES( STR_ALIGN_RIGHT ) ), bHighContrast ? maImgAlgin3h : maImgAlgin3 ); 398cdf0e10cSrcweir appendEntry( 3, String( SVX_RES( STR_ALIGN_WORD ) ), bHighContrast ? maImgAlgin4h : maImgAlgin4 ); 399cdf0e10cSrcweir appendEntry( 4, String( SVX_RES( STR_ALIGN_STRETCH ) ), bHighContrast ? maImgAlgin5h : maImgAlgin5 ); 400cdf0e10cSrcweir 401cdf0e10cSrcweir SetOutputSizePixel( getMenuSize() ); 402cdf0e10cSrcweir 403cdf0e10cSrcweir FreeResource(); 404cdf0e10cSrcweir 405cdf0e10cSrcweir AddStatusListener( msFontworkAlignment ); 406cdf0e10cSrcweir } 407cdf0e10cSrcweir 408cdf0e10cSrcweir // ----------------------------------------------------------------------- 409cdf0e10cSrcweir 410*199633b5SHerbert Dürr void FontworkAlignmentWindow::implSetAlignment( int nSurface, bool bEnabled ) 411cdf0e10cSrcweir { 412cdf0e10cSrcweir int i; 413cdf0e10cSrcweir for( i = 0; i < 5; i++ ) 414cdf0e10cSrcweir { 415cdf0e10cSrcweir checkEntry( i, (i == nSurface) && bEnabled ); 416cdf0e10cSrcweir enableEntry( i, bEnabled ); 417cdf0e10cSrcweir } 418cdf0e10cSrcweir } 419cdf0e10cSrcweir 420cdf0e10cSrcweir // ----------------------------------------------------------------------- 421cdf0e10cSrcweir 422*199633b5SHerbert Dürr void SAL_CALL FontworkAlignmentWindow::statusChanged( const frame::FeatureStateEvent& Event ) throw ( RuntimeException ) 423cdf0e10cSrcweir { 424cdf0e10cSrcweir if( Event.FeatureURL.Main.equals( msFontworkAlignment ) ) 425cdf0e10cSrcweir { 426cdf0e10cSrcweir if( !Event.IsEnabled ) 427cdf0e10cSrcweir { 428cdf0e10cSrcweir implSetAlignment( 0, false ); 429cdf0e10cSrcweir } 430cdf0e10cSrcweir else 431cdf0e10cSrcweir { 432cdf0e10cSrcweir sal_Int32 nValue = 0; 433cdf0e10cSrcweir if( Event.State >>= nValue ) 434cdf0e10cSrcweir implSetAlignment( nValue, true ); 435cdf0e10cSrcweir } 436cdf0e10cSrcweir } 437cdf0e10cSrcweir } 438cdf0e10cSrcweir 439cdf0e10cSrcweir // ----------------------------------------------------------------------- 440cdf0e10cSrcweir 441*199633b5SHerbert Dürr void FontworkAlignmentWindow::DataChanged( const DataChangedEvent& rDCEvt ) 442cdf0e10cSrcweir { 443cdf0e10cSrcweir ToolbarMenu::DataChanged( rDCEvt ); 444cdf0e10cSrcweir 445cdf0e10cSrcweir if( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) ) 446cdf0e10cSrcweir { 447cdf0e10cSrcweir bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); 448cdf0e10cSrcweir 449cdf0e10cSrcweir appendEntry( 0, String( SVX_RES( STR_ALIGN_LEFT ) ), bHighContrast ? maImgAlgin1h : maImgAlgin1 ); 450cdf0e10cSrcweir appendEntry( 1, String( SVX_RES( STR_ALIGN_CENTER ) ), bHighContrast ? maImgAlgin2h : maImgAlgin2 ); 451cdf0e10cSrcweir appendEntry( 2, String( SVX_RES( STR_ALIGN_RIGHT ) ), bHighContrast ? maImgAlgin3h : maImgAlgin3 ); 452cdf0e10cSrcweir appendEntry( 3, String( SVX_RES( STR_ALIGN_WORD ) ), bHighContrast ? maImgAlgin4h : maImgAlgin4 ); 453cdf0e10cSrcweir appendEntry( 4, String( SVX_RES( STR_ALIGN_STRETCH ) ), bHighContrast ? maImgAlgin5h : maImgAlgin5 ); 454cdf0e10cSrcweir } 455cdf0e10cSrcweir } 456cdf0e10cSrcweir 457cdf0e10cSrcweir // ----------------------------------------------------------------------- 458cdf0e10cSrcweir 459*199633b5SHerbert Dürr IMPL_LINK( FontworkAlignmentWindow, SelectHdl, void *, EMPTYARG ) 460cdf0e10cSrcweir { 461cdf0e10cSrcweir if ( IsInPopupMode() ) 462cdf0e10cSrcweir EndPopupMode(); 463cdf0e10cSrcweir 464cdf0e10cSrcweir sal_Int32 nAlignment = getSelectedEntryId(); 465cdf0e10cSrcweir if( nAlignment >= 0 ) 466cdf0e10cSrcweir { 467cdf0e10cSrcweir Sequence< PropertyValue > aArgs( 1 ); 468cdf0e10cSrcweir aArgs[0].Name = msFontworkAlignment.copy(5); 469cdf0e10cSrcweir aArgs[0].Value <<= (sal_Int32)nAlignment; 470cdf0e10cSrcweir 471cdf0e10cSrcweir mrController.dispatchCommand( msFontworkAlignment, aArgs ); 472cdf0e10cSrcweir 473cdf0e10cSrcweir implSetAlignment( nAlignment, true ); 474cdf0e10cSrcweir } 475cdf0e10cSrcweir 476cdf0e10cSrcweir return 0; 477cdf0e10cSrcweir } 478cdf0e10cSrcweir 479cdf0e10cSrcweir // ======================================================================== 480*199633b5SHerbert Dürr // FontworkAlignmentControl 481cdf0e10cSrcweir // ======================================================================== 482cdf0e10cSrcweir 483*199633b5SHerbert Dürr class FontworkAlignmentControl : public svt::PopupWindowController 484cdf0e10cSrcweir { 485cdf0e10cSrcweir public: 486*199633b5SHerbert Dürr FontworkAlignmentControl( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager ); 487cdf0e10cSrcweir 488cdf0e10cSrcweir virtual ::Window* createPopupWindow( ::Window* pParent ); 489cdf0e10cSrcweir 490cdf0e10cSrcweir // XServiceInfo 491cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException ); 492cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException ); 493cdf0e10cSrcweir 494cdf0e10cSrcweir using svt::PopupWindowController::createPopupWindow; 495cdf0e10cSrcweir }; 496cdf0e10cSrcweir 497cdf0e10cSrcweir 498cdf0e10cSrcweir // ----------------------------------------------------------------------- 499cdf0e10cSrcweir 500*199633b5SHerbert Dürr FontworkAlignmentControl::FontworkAlignmentControl( const Reference< lang::XMultiServiceFactory >& rServiceManager ) 501cdf0e10cSrcweir : svt::PopupWindowController( rServiceManager, Reference< frame::XFrame >(), OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontworkAlignment" ) ) ) 502cdf0e10cSrcweir { 503cdf0e10cSrcweir } 504cdf0e10cSrcweir 505cdf0e10cSrcweir // ----------------------------------------------------------------------- 506cdf0e10cSrcweir 507*199633b5SHerbert Dürr ::Window* FontworkAlignmentControl::createPopupWindow( ::Window* pParent ) 508cdf0e10cSrcweir { 509*199633b5SHerbert Dürr return new FontworkAlignmentWindow( *this, m_xFrame, pParent ); 510cdf0e10cSrcweir } 511cdf0e10cSrcweir 512cdf0e10cSrcweir // ----------------------------------------------------------------------- 513cdf0e10cSrcweir // XServiceInfo 514cdf0e10cSrcweir // ----------------------------------------------------------------------- 515cdf0e10cSrcweir 516*199633b5SHerbert Dürr OUString SAL_CALL FontworkAlignmentControl_getImplementationName() 517cdf0e10cSrcweir { 518*199633b5SHerbert Dürr return OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svx.FontworkAlignmentController" )); 519cdf0e10cSrcweir } 520cdf0e10cSrcweir 521cdf0e10cSrcweir // -------------------------------------------------------------------- 522cdf0e10cSrcweir 523*199633b5SHerbert Dürr Sequence< OUString > SAL_CALL FontworkAlignmentControl_getSupportedServiceNames() throw( RuntimeException ) 524cdf0e10cSrcweir { 525cdf0e10cSrcweir Sequence< OUString > aSNS( 1 ); 526cdf0e10cSrcweir aSNS.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ToolbarController" )); 527cdf0e10cSrcweir return aSNS; 528cdf0e10cSrcweir } 529cdf0e10cSrcweir 530cdf0e10cSrcweir // -------------------------------------------------------------------- 531cdf0e10cSrcweir 532*199633b5SHerbert Dürr Reference< XInterface > SAL_CALL SAL_CALL FontworkAlignmentControl_createInstance( const Reference< XMultiServiceFactory >& rSMgr ) throw( RuntimeException ) 533cdf0e10cSrcweir { 534*199633b5SHerbert Dürr return *new FontworkAlignmentControl( rSMgr ); 535cdf0e10cSrcweir } 536cdf0e10cSrcweir 537cdf0e10cSrcweir // -------------------------------------------------------------------- 538cdf0e10cSrcweir 539*199633b5SHerbert Dürr OUString SAL_CALL FontworkAlignmentControl::getImplementationName( ) throw (RuntimeException) 540cdf0e10cSrcweir { 541*199633b5SHerbert Dürr return FontworkAlignmentControl_getImplementationName(); 542cdf0e10cSrcweir } 543cdf0e10cSrcweir 544cdf0e10cSrcweir // -------------------------------------------------------------------- 545cdf0e10cSrcweir 546*199633b5SHerbert Dürr Sequence< OUString > SAL_CALL FontworkAlignmentControl::getSupportedServiceNames( ) throw (RuntimeException) 547cdf0e10cSrcweir { 548*199633b5SHerbert Dürr return FontworkAlignmentControl_getSupportedServiceNames(); 549cdf0e10cSrcweir } 550cdf0e10cSrcweir 551cdf0e10cSrcweir 552cdf0e10cSrcweir // #################################################################### 553cdf0e10cSrcweir 554*199633b5SHerbert Dürr class FontworkCharacterSpacingWindow : public ToolbarMenu 555cdf0e10cSrcweir { 556cdf0e10cSrcweir public: 557*199633b5SHerbert Dürr FontworkCharacterSpacingWindow( svt::ToolboxController& rController, const Reference< XFrame >& rFrame, Window* pParentWindow ); 558cdf0e10cSrcweir 559cdf0e10cSrcweir virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); 560cdf0e10cSrcweir private: 561cdf0e10cSrcweir svt::ToolboxController& mrController; 562cdf0e10cSrcweir 563cdf0e10cSrcweir const rtl::OUString msFontworkCharacterSpacing; 564cdf0e10cSrcweir const rtl::OUString msFontworkKernCharacterPairs; 565cdf0e10cSrcweir 566cdf0e10cSrcweir DECL_LINK( SelectHdl, void * ); 567cdf0e10cSrcweir 568cdf0e10cSrcweir void implSetCharacterSpacing( sal_Int32 nCharacterSpacing, bool bEnabled ); 569cdf0e10cSrcweir void implSetKernCharacterPairs( sal_Bool bKernOnOff, bool bEnabled ); 570cdf0e10cSrcweir 571cdf0e10cSrcweir }; 572cdf0e10cSrcweir 573cdf0e10cSrcweir // ----------------------------------------------------------------------- 574cdf0e10cSrcweir 575*199633b5SHerbert Dürr FontworkCharacterSpacingWindow::FontworkCharacterSpacingWindow( svt::ToolboxController& rController, const Reference< XFrame >& rFrame, Window* pParentWindow ) 576cdf0e10cSrcweir : ToolbarMenu( rFrame, pParentWindow, SVX_RES( RID_SVXFLOAT_FONTWORK_CHARSPACING )) 577cdf0e10cSrcweir , mrController( rController ) 578cdf0e10cSrcweir , msFontworkCharacterSpacing( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontworkCharacterSpacing" ) ) 579cdf0e10cSrcweir , msFontworkKernCharacterPairs( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontworkKernCharacterPairs" ) ) 580cdf0e10cSrcweir { 581cdf0e10cSrcweir SetHelpId( HID_POPUP_FONTWORK_CHARSPACE ); 582*199633b5SHerbert Dürr SetSelectHdl( LINK( this, FontworkCharacterSpacingWindow, SelectHdl ) ); 583cdf0e10cSrcweir 584cdf0e10cSrcweir appendEntry( 0, String( SVX_RES( STR_CHARS_SPACING_VERY_TIGHT ) ), MIB_RADIOCHECK ); 585cdf0e10cSrcweir appendEntry( 1, String( SVX_RES( STR_CHARS_SPACING_TIGHT ) ), MIB_RADIOCHECK ); 586cdf0e10cSrcweir appendEntry( 2, String( SVX_RES( STR_CHARS_SPACING_NORMAL ) ), MIB_RADIOCHECK ); 587cdf0e10cSrcweir appendEntry( 3, String( SVX_RES( STR_CHARS_SPACING_LOOSE ) ), MIB_RADIOCHECK ); 588cdf0e10cSrcweir appendEntry( 4, String( SVX_RES( STR_CHARS_SPACING_VERY_LOOSE ) ), MIB_RADIOCHECK ); 589cdf0e10cSrcweir appendEntry( 5, String( SVX_RES( STR_CHARS_SPACING_CUSTOM ) ), MIB_RADIOCHECK ); 590cdf0e10cSrcweir appendSeparator(); 591cdf0e10cSrcweir appendEntry( 6, String( SVX_RES( STR_CHARS_SPACING_KERN_PAIRS ) ), MIB_CHECKABLE ); 592cdf0e10cSrcweir 593cdf0e10cSrcweir SetOutputSizePixel( getMenuSize() ); 594cdf0e10cSrcweir 595cdf0e10cSrcweir FreeResource(); 596cdf0e10cSrcweir 597cdf0e10cSrcweir AddStatusListener( msFontworkCharacterSpacing ); 598cdf0e10cSrcweir AddStatusListener( msFontworkKernCharacterPairs ); 599cdf0e10cSrcweir } 600cdf0e10cSrcweir 601cdf0e10cSrcweir // ----------------------------------------------------------------------- 602cdf0e10cSrcweir 603*199633b5SHerbert Dürr void FontworkCharacterSpacingWindow::implSetCharacterSpacing( sal_Int32 nCharacterSpacing, bool bEnabled ) 604cdf0e10cSrcweir { 605cdf0e10cSrcweir sal_Int32 i; 606cdf0e10cSrcweir for ( i = 0; i < 6; i++ ) 607cdf0e10cSrcweir { 608cdf0e10cSrcweir checkEntry( i, sal_False ); 609cdf0e10cSrcweir enableEntry( i, bEnabled ); 610cdf0e10cSrcweir } 611cdf0e10cSrcweir if ( nCharacterSpacing != -1 ) 612cdf0e10cSrcweir { 613cdf0e10cSrcweir sal_Int32 nEntry; 614cdf0e10cSrcweir switch( nCharacterSpacing ) 615cdf0e10cSrcweir { 616cdf0e10cSrcweir case 80 : nEntry = 0; break; 617cdf0e10cSrcweir case 90 : nEntry = 1; break; 618cdf0e10cSrcweir case 100 : nEntry = 2; break; 619cdf0e10cSrcweir case 120 : nEntry = 3; break; 620cdf0e10cSrcweir case 150 : nEntry = 4; break; 621cdf0e10cSrcweir default : nEntry = 5; break; 622cdf0e10cSrcweir } 623cdf0e10cSrcweir checkEntry( nEntry, bEnabled ); 624cdf0e10cSrcweir } 625cdf0e10cSrcweir } 626cdf0e10cSrcweir 627cdf0e10cSrcweir // ----------------------------------------------------------------------- 628cdf0e10cSrcweir 629*199633b5SHerbert Dürr void FontworkCharacterSpacingWindow::implSetKernCharacterPairs( sal_Bool, bool bEnabled ) 630cdf0e10cSrcweir { 631cdf0e10cSrcweir enableEntry( 6, bEnabled ); 632cdf0e10cSrcweir checkEntry( 6, bEnabled ); 633cdf0e10cSrcweir } 634cdf0e10cSrcweir 635cdf0e10cSrcweir // ----------------------------------------------------------------------- 636cdf0e10cSrcweir 637*199633b5SHerbert Dürr void SAL_CALL FontworkCharacterSpacingWindow::statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ) 638cdf0e10cSrcweir { 639cdf0e10cSrcweir if( Event.FeatureURL.Main.equals( msFontworkCharacterSpacing ) ) 640cdf0e10cSrcweir { 641cdf0e10cSrcweir if( !Event.IsEnabled ) 642cdf0e10cSrcweir { 643cdf0e10cSrcweir implSetCharacterSpacing( 0, false ); 644cdf0e10cSrcweir } 645cdf0e10cSrcweir else 646cdf0e10cSrcweir { 647cdf0e10cSrcweir sal_Int32 nValue = 0; 648cdf0e10cSrcweir if( Event.State >>= nValue ) 649cdf0e10cSrcweir implSetCharacterSpacing( nValue, true ); 650cdf0e10cSrcweir } 651cdf0e10cSrcweir } 652cdf0e10cSrcweir else if( Event.FeatureURL.Main.equals( msFontworkKernCharacterPairs ) ) 653cdf0e10cSrcweir { 654cdf0e10cSrcweir if( !Event.IsEnabled ) 655cdf0e10cSrcweir { 656cdf0e10cSrcweir implSetKernCharacterPairs( 0, false ); 657cdf0e10cSrcweir } 658cdf0e10cSrcweir else 659cdf0e10cSrcweir { 660cdf0e10cSrcweir sal_Bool bValue = sal_False; 661cdf0e10cSrcweir if( Event.State >>= bValue ) 662cdf0e10cSrcweir implSetKernCharacterPairs( bValue, true ); 663cdf0e10cSrcweir } 664cdf0e10cSrcweir } 665cdf0e10cSrcweir } 666cdf0e10cSrcweir 667cdf0e10cSrcweir // ----------------------------------------------------------------------- 668cdf0e10cSrcweir 669*199633b5SHerbert Dürr IMPL_LINK( FontworkCharacterSpacingWindow, SelectHdl, void *, EMPTYARG ) 670cdf0e10cSrcweir { 671cdf0e10cSrcweir if ( IsInPopupMode() ) 672cdf0e10cSrcweir EndPopupMode(); 673cdf0e10cSrcweir 674cdf0e10cSrcweir sal_Int32 nSelection = getSelectedEntryId(); 675cdf0e10cSrcweir sal_Int32 nCharacterSpacing; 676cdf0e10cSrcweir switch( nSelection ) 677cdf0e10cSrcweir { 678cdf0e10cSrcweir case 0 : nCharacterSpacing = 80; break; 679cdf0e10cSrcweir case 1 : nCharacterSpacing = 90; break; 680cdf0e10cSrcweir case 2 : nCharacterSpacing = 100; break; 681cdf0e10cSrcweir case 3 : nCharacterSpacing = 120; break; 682cdf0e10cSrcweir case 4 : nCharacterSpacing = 150; break; 683cdf0e10cSrcweir default : nCharacterSpacing = 100; break; 684cdf0e10cSrcweir } 685cdf0e10cSrcweir if ( nSelection == 5 ) // custom spacing 686cdf0e10cSrcweir { 687cdf0e10cSrcweir Sequence< PropertyValue > aArgs( 1 ); 688cdf0e10cSrcweir aArgs[0].Name = msFontworkCharacterSpacing.copy(5); 689cdf0e10cSrcweir aArgs[0].Value <<= (sal_Int32)nCharacterSpacing; 690cdf0e10cSrcweir 691cdf0e10cSrcweir mrController.dispatchCommand( OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontworkCharacterSpacingDialog" )), aArgs ); 692cdf0e10cSrcweir } 693cdf0e10cSrcweir else if ( nSelection == 6 ) // KernCharacterPairs 694cdf0e10cSrcweir { 695cdf0e10cSrcweir rtl::OUString aCommand( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontworkKernCharacterPairs" )); 696cdf0e10cSrcweir 697cdf0e10cSrcweir Sequence< PropertyValue > aArgs( 1 ); 698cdf0e10cSrcweir aArgs[0].Name = msFontworkKernCharacterPairs.copy(5); 699cdf0e10cSrcweir aArgs[0].Value <<= (sal_Bool) sal_True; 700cdf0e10cSrcweir 701cdf0e10cSrcweir mrController.dispatchCommand( msFontworkKernCharacterPairs, aArgs ); 702cdf0e10cSrcweir 703cdf0e10cSrcweir implSetKernCharacterPairs( sal_True, true ); 704cdf0e10cSrcweir } 705cdf0e10cSrcweir else if( nSelection >= 0 ) 706cdf0e10cSrcweir { 707cdf0e10cSrcweir Sequence< PropertyValue > aArgs( 1 ); 708cdf0e10cSrcweir aArgs[0].Name = msFontworkCharacterSpacing.copy(5); 709cdf0e10cSrcweir aArgs[0].Value <<=( sal_Int32)nCharacterSpacing; 710cdf0e10cSrcweir 711cdf0e10cSrcweir mrController.dispatchCommand( msFontworkCharacterSpacing, aArgs ); 712cdf0e10cSrcweir 713cdf0e10cSrcweir implSetCharacterSpacing( nCharacterSpacing, true ); 714cdf0e10cSrcweir } 715cdf0e10cSrcweir 716cdf0e10cSrcweir return 0; 717cdf0e10cSrcweir } 718cdf0e10cSrcweir 719cdf0e10cSrcweir // ======================================================================== 720*199633b5SHerbert Dürr // FontworkCharacterSpacingControl 721cdf0e10cSrcweir // ======================================================================== 722cdf0e10cSrcweir 723*199633b5SHerbert Dürr class FontworkCharacterSpacingControl : public svt::PopupWindowController 724cdf0e10cSrcweir { 725cdf0e10cSrcweir public: 726*199633b5SHerbert Dürr FontworkCharacterSpacingControl( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager ); 727cdf0e10cSrcweir 728cdf0e10cSrcweir virtual ::Window* createPopupWindow( ::Window* pParent ); 729cdf0e10cSrcweir 730cdf0e10cSrcweir // XServiceInfo 731cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException ); 732cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException ); 733cdf0e10cSrcweir 734cdf0e10cSrcweir using svt::PopupWindowController::createPopupWindow; 735cdf0e10cSrcweir }; 736cdf0e10cSrcweir 737cdf0e10cSrcweir 738*199633b5SHerbert Dürr FontworkCharacterSpacingControl::FontworkCharacterSpacingControl( const Reference< lang::XMultiServiceFactory >& rServiceManager ) 739cdf0e10cSrcweir : svt::PopupWindowController( rServiceManager, Reference< frame::XFrame >(), OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontworkCharacterSpacingFloater" ) ) ) 740cdf0e10cSrcweir { 741cdf0e10cSrcweir } 742cdf0e10cSrcweir 743cdf0e10cSrcweir // ----------------------------------------------------------------------- 744cdf0e10cSrcweir 745*199633b5SHerbert Dürr ::Window* FontworkCharacterSpacingControl::createPopupWindow( ::Window* pParent ) 746cdf0e10cSrcweir { 747*199633b5SHerbert Dürr return new FontworkCharacterSpacingWindow( *this, m_xFrame, pParent ); 748cdf0e10cSrcweir } 749cdf0e10cSrcweir 750cdf0e10cSrcweir // ----------------------------------------------------------------------- 751cdf0e10cSrcweir // XServiceInfo 752cdf0e10cSrcweir // ----------------------------------------------------------------------- 753cdf0e10cSrcweir 754*199633b5SHerbert Dürr OUString SAL_CALL FontworkCharacterSpacingControl_getImplementationName() 755cdf0e10cSrcweir { 756*199633b5SHerbert Dürr return OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svx.FontworkCharacterSpacingController" )); 757cdf0e10cSrcweir } 758cdf0e10cSrcweir 759cdf0e10cSrcweir // -------------------------------------------------------------------- 760cdf0e10cSrcweir 761*199633b5SHerbert Dürr Sequence< OUString > SAL_CALL FontworkCharacterSpacingControl_getSupportedServiceNames() throw( RuntimeException ) 762cdf0e10cSrcweir { 763cdf0e10cSrcweir Sequence< OUString > aSNS( 1 ); 764cdf0e10cSrcweir aSNS.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ToolbarController" )); 765cdf0e10cSrcweir return aSNS; 766cdf0e10cSrcweir } 767cdf0e10cSrcweir 768cdf0e10cSrcweir // -------------------------------------------------------------------- 769cdf0e10cSrcweir 770*199633b5SHerbert Dürr Reference< XInterface > SAL_CALL SAL_CALL FontworkCharacterSpacingControl_createInstance( const Reference< XMultiServiceFactory >& rSMgr ) throw( RuntimeException ) 771cdf0e10cSrcweir { 772*199633b5SHerbert Dürr return *new FontworkCharacterSpacingControl( rSMgr ); 773cdf0e10cSrcweir } 774cdf0e10cSrcweir 775cdf0e10cSrcweir // -------------------------------------------------------------------- 776cdf0e10cSrcweir 777*199633b5SHerbert Dürr OUString SAL_CALL FontworkCharacterSpacingControl::getImplementationName( ) throw (RuntimeException) 778cdf0e10cSrcweir { 779*199633b5SHerbert Dürr return FontworkCharacterSpacingControl_getImplementationName(); 780cdf0e10cSrcweir } 781cdf0e10cSrcweir 782cdf0e10cSrcweir // -------------------------------------------------------------------- 783cdf0e10cSrcweir 784*199633b5SHerbert Dürr Sequence< OUString > SAL_CALL FontworkCharacterSpacingControl::getSupportedServiceNames( ) throw (RuntimeException) 785cdf0e10cSrcweir { 786*199633b5SHerbert Dürr return FontworkCharacterSpacingControl_getSupportedServiceNames(); 787cdf0e10cSrcweir } 788cdf0e10cSrcweir 789cdf0e10cSrcweir // ======================================================================== 790cdf0e10cSrcweir // FontworkCharacterSpacingDialog 791cdf0e10cSrcweir // ======================================================================== 792cdf0e10cSrcweir 793cdf0e10cSrcweir FontworkCharacterSpacingDialog::FontworkCharacterSpacingDialog( Window* pParent, sal_Int32 nScale ) 794cdf0e10cSrcweir : ModalDialog( pParent, SVX_RES( RID_SVX_MDLG_FONTWORK_CHARSPACING ) ), 795cdf0e10cSrcweir maFLScale( this, SVX_RES( FT_VALUE ) ), 796cdf0e10cSrcweir maMtrScale( this, SVX_RES( MF_VALUE ) ), 797cdf0e10cSrcweir maOKButton( this, SVX_RES( BTN_OK ) ), 798cdf0e10cSrcweir maCancelButton( this, SVX_RES( BTN_CANCEL ) ), 799cdf0e10cSrcweir maHelpButton( this, SVX_RES( BTN_HELP ) ) 800cdf0e10cSrcweir { 801cdf0e10cSrcweir maMtrScale.SetValue( nScale ); 802cdf0e10cSrcweir FreeResource(); 803cdf0e10cSrcweir } 804cdf0e10cSrcweir 805cdf0e10cSrcweir FontworkCharacterSpacingDialog::~FontworkCharacterSpacingDialog() 806cdf0e10cSrcweir { 807cdf0e10cSrcweir } 808cdf0e10cSrcweir 809cdf0e10cSrcweir sal_Int32 FontworkCharacterSpacingDialog::getScale() const 810cdf0e10cSrcweir { 811cdf0e10cSrcweir return (sal_Int32)maMtrScale.GetValue(); 812cdf0e10cSrcweir } 813cdf0e10cSrcweir 814cdf0e10cSrcweir } 815