cui/AllLangResTarget_cui.mk | 1 cui/UI_cui.mk | 1 cui/source/dialogs/charmap.hrc | 41 ----- cui/source/dialogs/charmap.src | 131 ---------------- cui/source/dialogs/cuicharmap.cxx | 199 ++++++++++++------------ cui/source/factory/dlgfact.cxx | 17 -- cui/source/inc/cuicharmap.hxx | 29 +-- cui/source/tabpages/chardlg.cxx | 28 +-- cui/uiconfig/ui/specialcharacters.ui | 284 +++++++++++++++++++++++++++++++++++ svx/inc/svx/charmap.hxx | 5 svx/source/dialog/charmap.cxx | 39 ++++ vcl/inc/vcl/dialog.hxx | 1 vcl/source/window/builder.cxx | 24 ++ vcl/source/window/dialog.cxx | 16 + vcl/source/window/window2.cxx | 4 15 files changed, 492 insertions(+), 328 deletions(-)
New commits: commit 3275011339165067468e8dc5a665ed5ab119b878 Author: Caolán McNamara <caol...@redhat.com> Date: Wed Sep 26 16:14:28 2012 +0100 defer initializing dialog until sizeable/unsizeable is known we have to defer initializing the dialog until we have determined the sizeable/unsizable info as we can't change it after the fact Change-Id: I27c90f8f92953d919b36cddc6a99fae9d7db47eb diff --git a/vcl/inc/vcl/dialog.hxx b/vcl/inc/vcl/dialog.hxx index aa3c9cd..28fb81e 100644 --- a/vcl/inc/vcl/dialog.hxx +++ b/vcl/inc/vcl/dialog.hxx @@ -81,6 +81,7 @@ protected: public: SAL_DLLPRIVATE sal_Bool IsInClose() const { return mbInClose; } SAL_DLLPRIVATE bool hasPendingLayout() const { return maLayoutTimer.IsActive(); } + SAL_DLLPRIVATE void doDeferredInit(bool bResizable); protected: Dialog( WindowType nType ); diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index 3e9ed91..31e72ce 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -203,6 +203,18 @@ namespace return sPattern; } + bool extractResizable(VclBuilder::stringmap &rMap) + { + bool bResizable = true; + VclBuilder::stringmap::iterator aFind = rMap.find(rtl::OString(RTL_CONSTASCII_STRINGPARAM("resizable"))); + if (aFind != rMap.end()) + { + bResizable = toBool(aFind->second); + rMap.erase(aFind); + } + return bResizable; + } + bool extractOrientation(VclBuilder::stringmap &rMap) { bool bVertical = false; @@ -432,7 +444,12 @@ Window *VclBuilder::makeObject(Window *pParent, const rtl::OString &name, const Window *pWindow = NULL; if (name.equalsL(RTL_CONSTASCII_STRINGPARAM("GtkDialog"))) - pWindow = new Dialog(pParent, WB_SIZEMOVE|WB_3DLOOK|WB_CLOSEABLE); + { + WinBits nBits = WB_MOVEABLE|WB_3DLOOK|WB_CLOSEABLE; + if (extractResizable(rMap)) + nBits |= WB_SIZEABLE; + pWindow = new Dialog(pParent, nBits); + } else if (name.equalsL(RTL_CONSTASCII_STRINGPARAM("GtkBox"))) { if (extractOrientation(rMap)) @@ -601,7 +618,10 @@ Window *VclBuilder::insertObject(Window *pParent, const rtl::OString &rClass, co pCurrentChild = m_pParent; //toplevels default to resizable if (pCurrentChild->IsDialog()) - pCurrentChild->SetStyle(pCurrentChild->GetStyle() | WB_SIZEMOVE | WB_3DLOOK); + { + Dialog *pDialog = (Dialog*)pCurrentChild; + pDialog->doDeferredInit(extractResizable(rMap)); + } if (pCurrentChild->GetHelpId().isEmpty()) { pCurrentChild->SetHelpId(m_sHelpRoot + m_sID); diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx index 78a426d..64907b2 100644 --- a/vcl/source/window/dialog.cxx +++ b/vcl/source/window/dialog.cxx @@ -504,19 +504,31 @@ rtl::OUString VclBuilderContainer::getUIRootDir() return sShareLayer; } +//we can't change sizeable after the fact, so need to defer until we know and then +//do the init. Find the real parent stashed in mpDialogParent. +void Dialog::doDeferredInit(bool bResizable) +{ + WinBits nBits = WB_3DLOOK|WB_CLOSEABLE|WB_MOVEABLE; + if (bResizable) + nBits |= WB_SIZEABLE; + Window *pParent = mpDialogParent; + mpDialogParent = NULL; + ImplInit(pParent, nBits); +} + Dialog::Dialog(Window* pParent, const rtl::OString& rID, const rtl::OUString& rUIXMLDescription) : SystemWindow( WINDOW_DIALOG ) + , mpDialogParent(pParent) //will be unset in doDeferredInit { ImplInitDialogData(); - ImplInit(pParent, WB_SIZEMOVE|WB_3DLOOK|WB_CLOSEABLE); m_pUIBuilder = new VclBuilder(this, getUIRootDir(), rUIXMLDescription, rID); } Dialog::Dialog(Window* pParent, const rtl::OString& rID, const rtl::OUString& rUIXMLDescription, WindowType nType) : SystemWindow( nType ) + , mpDialogParent(pParent) //will be unset in doDeferredInit { ImplInitDialogData(); - ImplInit(pParent, WB_SIZEMOVE|WB_3DLOOK|WB_CLOSEABLE); m_pUIBuilder = new VclBuilder(this, getUIRootDir(), rUIXMLDescription, rID); } diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx index 240b669..27a77ae 100644 --- a/vcl/source/window/window2.cxx +++ b/vcl/source/window/window2.cxx @@ -1967,9 +1967,9 @@ bool Window::set_property(const rtl::OString &rKey, const rtl::OString &rValue) else if (rKey.equalsL(RTL_CONSTASCII_STRINGPARAM("resizable"))) { WinBits nBits = GetStyle(); - nBits &= ~(WB_SIZEMOVE); + nBits &= ~(WB_SIZEABLE); if (toBool(rValue)) - nBits |= WB_SIZEMOVE; + nBits |= WB_SIZEABLE; SetStyle(nBits); } else if (rKey.equalsL(RTL_CONSTASCII_STRINGPARAM("xalign"))) commit 99c6face0e1a5ea09d4cb6915c4501d5e620b067 Author: Caolán McNamara <caol...@redhat.com> Date: Wed Sep 26 15:31:01 2012 +0100 adapt insert character dialog to new layout Change-Id: I5561c2684d0957b65aef0d139e9210ebdd703153 diff --git a/cui/AllLangResTarget_cui.mk b/cui/AllLangResTarget_cui.mk index 840193f..4af4058 100644 --- a/cui/AllLangResTarget_cui.mk +++ b/cui/AllLangResTarget_cui.mk @@ -55,7 +55,6 @@ $(eval $(call gb_SrsTarget_add_files,cui/res,\ cui/source/customize/macropg.src \ cui/source/customize/selector.src \ cui/source/dialogs/about.src \ - cui/source/dialogs/charmap.src \ cui/source/dialogs/colorpicker.src \ cui/source/dialogs/commonlingui.src \ cui/source/dialogs/cuiimapdlg.src \ diff --git a/cui/UI_cui.mk b/cui/UI_cui.mk index 89e1a6a..c2d51e6 100644 --- a/cui/UI_cui.mk +++ b/cui/UI_cui.mk @@ -13,6 +13,7 @@ $(eval $(call gb_UI_add_uifiles,cui,\ cui/uiconfig/ui/charnamepage \ cui/uiconfig/ui/effectspage \ cui/uiconfig/ui/positionpage \ + cui/uiconfig/ui/specialcharacters \ cui/uiconfig/ui/twolinespage \ cui/uiconfig/ui/zoomdialog \ )) diff --git a/cui/source/dialogs/charmap.hrc b/cui/source/dialogs/charmap.hrc deleted file mode 100644 index c317612..0000000 --- a/cui/source/dialogs/charmap.hrc +++ /dev/null @@ -1,41 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * 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 regarding copyright - * ownership. The ASF licenses this file 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 . - */ -#ifndef _SVX_CHARMAP_HRC -#define _SVX_CHARMAP_HRC - -// defines ------------------------------------------------------------------ - -#define CT_SHOWSET 10 -#define FT_FONT 11 -#define LB_FONT 12 -#define CT_SHOWTEXT 13 -#define FT_SYMBOLE 14 -#define CT_SHOWCHAR 15 -#define FT_CHARCODE 16 -#define BTN_CHAR_OK 17 -#define BTN_CHAR_CANCEL 18 -#define BTN_CHAR_HELP 19 -#define BTN_DELETE 20 -#define FT_SUBSET 30 -#define LB_SUBSET 31 -#define ED_SHORTCUT 32 -#define BT_ASSIGN 33 -#define FT_ASSIGN 34 - -#endif - diff --git a/cui/source/dialogs/charmap.src b/cui/source/dialogs/charmap.src deleted file mode 100644 index 54c966f..0000000 --- a/cui/source/dialogs/charmap.src +++ /dev/null @@ -1,131 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * 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 regarding copyright - * ownership. The ASF licenses this file 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 . - */ - - // include --------------------------------------------------------------- - -#include <cuires.hrc> -#include "charmap.hrc" -#include "helpid.hrc" -#include <svx/dialogs.hrc> // for RID_SVXDLG_CHARMAP - - // RID_SVXDLG_CHARMAP ---------------------------------------------------- -ModalDialog RID_SVXDLG_CHARMAP -{ - HelpId = CMD_SID_CHARMAP ; - SvLook = TRUE ; - Text [ en-US ] = "Special Characters"; - Size = MAP_APPFONT ( 297 , 153 ) ; - OutputSize = TRUE ; - Moveable = TRUE ; - Control CT_SHOWSET - { - HelpId = HID_CHARMAP_CTL_SHOWSET ; - Border = TRUE ; - Pos = MAP_APPFONT ( 6 , 24 ) ; - Size = MAP_APPFONT ( 230 , 112 ) ; - TabStop = TRUE ; - Group = TRUE ; - }; - FixedText FT_FONT - { - Pos = MAP_APPFONT ( 6 , 8 ) ; - Size = MAP_APPFONT ( 33 , 8 ) ; - Text [ en-US ] = "~Font" ; - Left = TRUE ; - Group = TRUE ; - }; - ListBox LB_FONT - { - HelpID = "cui:ListBox:RID_SVXDLG_CHARMAP:LB_FONT"; - Pos = MAP_APPFONT ( 42 , 6 ) ; - Size = MAP_APPFONT ( 70 , 58 ) ; - Sort = TRUE ; - TabStop = TRUE ; - DropDown = TRUE ; - }; - FixedText FT_SUBSET - { - Pos = MAP_APPFONT ( 118 , 8 ) ; - Size = MAP_APPFONT ( 42 , 8 ) ; - Text [ en-US ] = "~Subset"; - }; - ListBox LB_SUBSET - { - HelpID = "cui:ListBox:RID_SVXDLG_CHARMAP:LB_SUBSET"; - Pos = MAP_APPFONT ( 161 , 6 ) ; - Size = MAP_APPFONT ( 63 , 68 ) ; - Sort = FALSE ; - TabStop = TRUE ; - DropDown = TRUE ; - }; - FixedText FT_SYMBOLE - { - Pos = MAP_APPFONT ( 6 , 140 ) ; - Size = MAP_APPFONT ( 38 , 8 ) ; - Left = TRUE ; - Text [ en-US ] = "Characters:"; - }; - Control CT_SHOWTEXT - { - HelpId = HID_CHARMAP_CTL_SHOWTEXT ; - Pos = MAP_APPFONT ( 46 , 137 ) ; - Size = MAP_APPFONT ( 244 , 16 ) ; - Group = TRUE ; - }; - Control CT_SHOWCHAR - { - HelpId = HID_CHARMAP_CTL_SHOWCHAR ; - Pos = MAP_APPFONT ( 241 , 79 ) ; - Size = MAP_APPFONT ( 50 , 44 ) ; - Group = TRUE ; - }; - FixedText FT_CHARCODE - { - Pos = MAP_APPFONT ( 241 , 126 ) ; - Size = MAP_APPFONT ( 50 , 8 ) ; - Center = TRUE ; - }; - OKButton BTN_CHAR_OK - { - Pos = MAP_APPFONT ( 242 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton BTN_CHAR_CANCEL - { - Pos = MAP_APPFONT ( 242 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - HelpButton BTN_CHAR_HELP - { - Pos = MAP_APPFONT ( 242 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - PushButton BTN_DELETE - { - HelpID = "cui:PushButton:RID_SVXDLG_CHARMAP:BTN_DELETE"; - Pos = MAP_APPFONT ( 242 , 63 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~Delete"; - }; -}; - -// ********************************************************************** EOF diff --git a/cui/source/dialogs/cuicharmap.cxx b/cui/source/dialogs/cuicharmap.cxx index f3ee121..2859346 100644 --- a/cui/source/dialogs/cuicharmap.cxx +++ b/cui/source/dialogs/cuicharmap.cxx @@ -50,29 +50,28 @@ #include <sfx2/sfxsids.hrc> #include <sfx2/app.hxx> #include <editeng/fontitem.hxx> -#include "charmap.hrc" #include "macroass.hxx" // class SvxCharacterMap ================================================= SvxCharacterMap::SvxCharacterMap( Window* pParent, sal_Bool bOne_, const SfxItemSet* pSet ) - : SfxModalDialog( pParent, CUI_RES( RID_SVXDLG_CHARMAP ) ), - aShowSet ( this, CUI_RES( CT_SHOWSET ) ), - aShowText ( this, CUI_RES( CT_SHOWTEXT ) ), - aOKBtn ( this, CUI_RES( BTN_CHAR_OK ) ), - aCancelBtn ( this, CUI_RES( BTN_CHAR_CANCEL ) ), - aHelpBtn ( this, CUI_RES( BTN_CHAR_HELP ) ), - aDeleteBtn ( this, CUI_RES( BTN_DELETE ) ), - aFontText ( this, CUI_RES( FT_FONT ) ), - aFontLB ( this, CUI_RES( LB_FONT ) ), - aSubsetText ( this, CUI_RES( FT_SUBSET ) ), - aSubsetLB ( this, CUI_RES( LB_SUBSET ) ), - aSymbolText ( this, CUI_RES( FT_SYMBOLE ) ), - aShowChar ( this, CUI_RES( CT_SHOWCHAR ), sal_True ), - aCharCodeText ( this, CUI_RES( FT_CHARCODE ) ), - bOne( bOne_ ), - pSubsetMap( NULL ) + : SfxModalDialog(pParent, "SpecialCharactersDialog", "cui/ui/specialcharacters.ui") + , bOne( bOne_ ) + , pSubsetMap( NULL ) { + get(m_pShowSet, "showcharset"); + get(m_pShowChar, "showchar"); + m_pShowChar->SetCentered(true); + get(m_pShowText, "showtext"); + get(m_pOKBtn, "ok"); + get(m_pDeleteBtn, "delete"); + get(m_pFontText, "fontft"); + get(m_pFontLB, "fontlb"); + get(m_pSubsetText, "subsetft"); + get(m_pSubsetLB, "subsetlb"); + get(m_pCharCodeText, "charcodeft"); + get(m_pSymbolText, "symboltext"); + SFX_ITEMSET_ARG( pSet, pItem, SfxBoolItem, FN_PARAM_1, sal_False ); if ( pItem ) bOne = pItem->GetValue(); @@ -103,7 +102,6 @@ SvxCharacterMap::SvxCharacterMap( Window* pParent, sal_Bool bOne_, const SfxItem SetCharFont( aTmpFont ); } - FreeResource(); CreateOutputItemSet( pSet ? *pSet->GetPool() : SFX_APP()->GetPool() ); } @@ -124,21 +122,21 @@ const Font& SvxCharacterMap::GetCharFont() const void SvxCharacterMap::SetChar( sal_UCS4 c ) { - aShowSet.SelectCharacter( c ); + m_pShowSet->SelectCharacter( c ); } // ----------------------------------------------------------------------- sal_UCS4 SvxCharacterMap::GetChar() const { - return aShowSet.GetSelectCharacter(); + return m_pShowSet->GetSelectCharacter(); } // ----------------------------------------------------------------------- String SvxCharacterMap::GetCharacters() const { - return aShowText.GetText(); + return m_pShowText->GetText(); } @@ -146,8 +144,8 @@ String SvxCharacterMap::GetCharacters() const void SvxCharacterMap::DisableFontSelection() { - aFontText.Disable(); - aFontLB.Disable(); + m_pFontText->Disable(); + m_pFontLB->Disable(); } short SvxCharacterMap::Execute() @@ -179,6 +177,16 @@ SvxShowText::SvxShowText( Window* pParent, const ResId& rResId, sal_Bool bCenter mbCenter( bCenter) {} +SvxShowText::SvxShowText( Window* pParent, sal_Bool bCenter ) +: Control( pParent ), + mbCenter( bCenter) +{} + +extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeSvxShowText(Window *pParent, VclBuilder::stringmap &) +{ + return new SvxShowText(pParent); +} + // ----------------------------------------------------------------------- void SvxShowText::Paint( const Rectangle& ) @@ -248,6 +256,12 @@ void SvxShowText::SetFont( const Font& rFont ) Invalidate(); } +void SvxShowText::Resize() +{ + Control::Resize(); + SetFont(GetFont()); //force recalculation of size +} + // ----------------------------------------------------------------------- void SvxShowText::SetText( const String& rText ) @@ -271,14 +285,11 @@ void SvxCharacterMap::init() aFont.SetPitch( PITCH_DONTKNOW ); aFont.SetCharSet( RTL_TEXTENCODING_DONTKNOW ); - if ( bOne ) + if (bOne) { - Size aDlgSize = GetSizePixel(); - SetSizePixel( Size( aDlgSize.Width(), - aDlgSize.Height()-aShowText.GetSizePixel().Height() ) ); - aSymbolText.Hide(); - aShowText.Hide(); - aDeleteBtn.Hide(); + m_pSymbolText->Hide(); + m_pShowText->Hide(); + m_pDeleteBtn->Hide(); } rtl::OUString aDefStr( aFont.GetName() ); @@ -290,21 +301,21 @@ void SvxCharacterMap::init() if ( aFontName != aLastName ) { aLastName = aFontName; - sal_uInt16 nPos = aFontLB.InsertEntry( aFontName ); - aFontLB.SetEntryData( nPos, (void*)(sal_uLong)i ); + sal_uInt16 nPos = m_pFontLB->InsertEntry( aFontName ); + m_pFontLB->SetEntryData( nPos, (void*)(sal_uLong)i ); } } // the font may not be in the list => // try to find a font name token in list and select found font, // else select topmost entry - bool bFound = (aFontLB.GetEntryPos( aDefStr ) == LISTBOX_ENTRY_NOTFOUND ); + bool bFound = (m_pFontLB->GetEntryPos( aDefStr ) == LISTBOX_ENTRY_NOTFOUND ); if( !bFound ) { sal_Int32 nIndex = 0; do { rtl::OUString aToken = aDefStr.getToken(0, ';', nIndex); - if ( aFontLB.GetEntryPos( aToken ) != LISTBOX_ENTRY_NOTFOUND ) + if ( m_pFontLB->GetEntryPos( aToken ) != LISTBOX_ENTRY_NOTFOUND ) { aDefStr = aToken; bFound = sal_True; @@ -315,29 +326,24 @@ void SvxCharacterMap::init() } if ( bFound ) - aFontLB.SelectEntry( aDefStr ); - else if ( aFontLB.GetEntryCount() ) - aFontLB.SelectEntryPos(0); - FontSelectHdl( &aFontLB ); - - aOKBtn.SetClickHdl( LINK( this, SvxCharacterMap, OKHdl ) ); - aFontLB.SetSelectHdl( LINK( this, SvxCharacterMap, FontSelectHdl ) ); - aSubsetLB.SetSelectHdl( LINK( this, SvxCharacterMap, SubsetSelectHdl ) ); - aShowSet.SetDoubleClickHdl( LINK( this, SvxCharacterMap, CharDoubleClickHdl ) ); - aShowSet.SetSelectHdl( LINK( this, SvxCharacterMap, CharSelectHdl ) ); - aShowSet.SetHighlightHdl( LINK( this, SvxCharacterMap, CharHighlightHdl ) ); - aShowSet.SetPreSelectHdl( LINK( this, SvxCharacterMap, CharPreSelectHdl ) ); - aDeleteBtn.SetClickHdl( LINK( this, SvxCharacterMap, DeleteHdl ) ); + m_pFontLB->SelectEntry( aDefStr ); + else if ( m_pFontLB->GetEntryCount() ) + m_pFontLB->SelectEntryPos(0); + FontSelectHdl(m_pFontLB); + + m_pOKBtn->SetClickHdl( LINK( this, SvxCharacterMap, OKHdl ) ); + m_pFontLB->SetSelectHdl( LINK( this, SvxCharacterMap, FontSelectHdl ) ); + m_pSubsetLB->SetSelectHdl( LINK( this, SvxCharacterMap, SubsetSelectHdl ) ); + m_pShowSet->SetDoubleClickHdl( LINK( this, SvxCharacterMap, CharDoubleClickHdl ) ); + m_pShowSet->SetSelectHdl( LINK( this, SvxCharacterMap, CharSelectHdl ) ); + m_pShowSet->SetHighlightHdl( LINK( this, SvxCharacterMap, CharHighlightHdl ) ); + m_pShowSet->SetPreSelectHdl( LINK( this, SvxCharacterMap, CharPreSelectHdl ) ); + m_pDeleteBtn->SetClickHdl( LINK( this, SvxCharacterMap, DeleteHdl ) ); if( SvxShowCharSet::getSelectedChar() == ' ') - aOKBtn.Disable(); + m_pOKBtn->Disable(); else - aOKBtn.Enable(); - - // left align aShowText field - int nLeftEdge = aSymbolText.GetPosPixel().X(); - nLeftEdge += aSymbolText.GetTextWidth( aSymbolText.GetText() ); - aShowText.SetPosPixel( Point( nLeftEdge+4, aShowText.GetPosPixel().Y() ) ); + m_pOKBtn->Enable(); } // ----------------------------------------------------------------------- @@ -348,12 +354,12 @@ void SvxCharacterMap::SetCharFont( const Font& rFont ) // like "Times New Roman;Times" resolved Font aTmp( GetFontMetric( rFont ) ); - if ( aFontLB.GetEntryPos( aTmp.GetName() ) == LISTBOX_ENTRY_NOTFOUND ) + if ( m_pFontLB->GetEntryPos( aTmp.GetName() ) == LISTBOX_ENTRY_NOTFOUND ) return; - aFontLB.SelectEntry( aTmp.GetName() ); + m_pFontLB->SelectEntry( aTmp.GetName() ); aFont = aTmp; - FontSelectHdl( &aFontLB ); + FontSelectHdl(m_pFontLB); // for compatibility reasons ModalDialog::SetFont( aFont ); @@ -363,14 +369,14 @@ void SvxCharacterMap::SetCharFont( const Font& rFont ) IMPL_LINK_NOARG(SvxCharacterMap, OKHdl) { - String aStr = aShowText.GetText(); + String aStr = m_pShowText->GetText(); if ( !aStr.Len() ) { - sal_UCS4 cChar = aShowSet.GetSelectCharacter(); + sal_UCS4 cChar = m_pShowSet->GetSelectCharacter(); // using the new UCS4 constructor rtl::OUString aOUStr( &cChar, 1 ); - aShowText.SetText( aOUStr ); + m_pShowText->SetText( aOUStr ); } EndDialog( sal_True ); return 0; @@ -380,8 +386,8 @@ IMPL_LINK_NOARG(SvxCharacterMap, OKHdl) IMPL_LINK_NOARG(SvxCharacterMap, FontSelectHdl) { - sal_uInt16 nPos = aFontLB.GetSelectEntryPos(), - nFont = (sal_uInt16)(sal_uLong)aFontLB.GetEntryData( nPos ); + sal_uInt16 nPos = m_pFontLB->GetSelectEntryPos(), + nFont = (sal_uInt16)(sal_uLong)m_pFontLB->GetEntryData( nPos ); aFont = GetDevFont( nFont ); aFont.SetWeight( WEIGHT_DONTKNOW ); aFont.SetItalic( ITALIC_NONE ); @@ -390,50 +396,43 @@ IMPL_LINK_NOARG(SvxCharacterMap, FontSelectHdl) aFont.SetFamily( FAMILY_DONTKNOW ); // notify children using this font - aShowSet.SetFont( aFont ); - aShowChar.SetFont( aFont ); - aShowText.SetFont( aFont ); - - // right align some fields to aShowSet - int nRightEdge = aShowSet.GetPosPixel().X() + aShowSet.GetOutputSizePixel().Width(); - Size aNewSize = aSubsetLB.GetOutputSizePixel(); - aNewSize.setWidth( nRightEdge - aSubsetLB.GetPosPixel().X() ); - aSubsetLB.SetOutputSizePixel( aNewSize ); + m_pShowSet->SetFont( aFont ); + m_pShowChar->SetFont( aFont ); + m_pShowText->SetFont( aFont ); // setup unicode subset listbar with font specific subsets, // hide unicode subset listbar for symbol fonts // TODO: get info from the Font once it provides it - if( pSubsetMap) - delete pSubsetMap; + delete pSubsetMap; pSubsetMap = NULL; sal_Bool bNeedSubset = (aFont.GetCharSet() != RTL_TEXTENCODING_SYMBOL); if( bNeedSubset ) { FontCharMap aFontCharMap; - aShowSet.GetFontCharMap( aFontCharMap ); + m_pShowSet->GetFontCharMap( aFontCharMap ); pSubsetMap = new SubsetMap( &aFontCharMap ); // update subset listbox for new font's unicode subsets - aSubsetLB.Clear(); + m_pSubsetLB->Clear(); // TODO: is it worth to improve the stupid linear search? bool bFirst = true; const Subset* s; while( NULL != (s = pSubsetMap->GetNextSubset( bFirst )) ) { - sal_uInt16 nPos_ = aSubsetLB.InsertEntry( s->GetName() ); - aSubsetLB.SetEntryData( nPos_, (void*)s ); + sal_uInt16 nPos_ = m_pSubsetLB->InsertEntry( s->GetName() ); + m_pSubsetLB->SetEntryData( nPos_, (void*)s ); // NOTE: subset must live at least as long as the selected font if( bFirst ) - aSubsetLB.SelectEntryPos( nPos_ ); + m_pSubsetLB->SelectEntryPos( nPos_ ); bFirst = false; } - if( aSubsetLB.GetEntryCount() <= 1 ) + if( m_pSubsetLB->GetEntryCount() <= 1 ) bNeedSubset = sal_False; } - aSubsetText.Show( bNeedSubset); - aSubsetLB.Show( bNeedSubset); + m_pSubsetText->Show( bNeedSubset); + m_pSubsetLB->Show( bNeedSubset); return 0; } @@ -442,14 +441,14 @@ IMPL_LINK_NOARG(SvxCharacterMap, FontSelectHdl) IMPL_LINK_NOARG(SvxCharacterMap, SubsetSelectHdl) { - sal_uInt16 nPos = aSubsetLB.GetSelectEntryPos(); - const Subset* pSubset = reinterpret_cast<const Subset*> (aSubsetLB.GetEntryData(nPos)); + sal_uInt16 nPos = m_pSubsetLB->GetSelectEntryPos(); + const Subset* pSubset = reinterpret_cast<const Subset*> (m_pSubsetLB->GetEntryData(nPos)); if( pSubset ) { sal_UCS4 cFirst = pSubset->GetRangeMin(); - aShowSet.SelectCharacter( cFirst ); + m_pShowSet->SelectCharacter( cFirst ); } - aSubsetLB.SelectEntryPos( nPos ); + m_pSubsetLB->SelectEntryPos( nPos ); return 0; } @@ -467,20 +466,20 @@ IMPL_LINK_NOARG(SvxCharacterMap, CharSelectHdl) { if ( !bOne ) { - String aText = aShowText.GetText(); + String aText = m_pShowText->GetText(); if ( aText.Len() == CHARMAP_MAXLEN ) Sound::Beep( SOUND_WARNING ); else { - sal_UCS4 cChar = aShowSet.GetSelectCharacter(); + sal_UCS4 cChar = m_pShowSet->GetSelectCharacter(); // using the new UCS4 constructor rtl::OUString aOUStr( &cChar, 1 ); - aShowText.SetText( aText + aOUStr ); + m_pShowText->SetText( aText + aOUStr ); } } - aOKBtn.Enable(); + m_pOKBtn->Enable(); return 0; } @@ -489,7 +488,7 @@ IMPL_LINK_NOARG(SvxCharacterMap, CharSelectHdl) IMPL_LINK_NOARG(SvxCharacterMap, CharHighlightHdl) { String aText; - sal_UCS4 cChar = aShowSet.GetSelectCharacter(); + sal_UCS4 cChar = m_pShowSet->GetSelectCharacter(); sal_Bool bSelect = (cChar > 0); // show char sample @@ -502,12 +501,12 @@ IMPL_LINK_NOARG(SvxCharacterMap, CharHighlightHdl) if( pSubsetMap ) pSubset = pSubsetMap->GetSubsetByUnicode( cChar ); if( pSubset ) - aSubsetLB.SelectEntry( pSubset->GetName() ); + m_pSubsetLB->SelectEntry( pSubset->GetName() ); else - aSubsetLB.SetNoSelection(); + m_pSubsetLB->SetNoSelection(); } - aShowChar.SetText( aText ); - aShowChar.Update(); + m_pShowChar->SetText( aText ); + m_pShowChar->Update(); // show char code if ( bSelect ) @@ -518,7 +517,7 @@ IMPL_LINK_NOARG(SvxCharacterMap, CharHighlightHdl) snprintf( aBuf+6, sizeof(aBuf)-6, " (%u)", static_cast<unsigned>(cChar) ); aText = String::CreateFromAscii( aBuf ); } - aCharCodeText.SetText( aText ); + m_pCharCodeText->SetText( aText ); return 0; } @@ -530,13 +529,13 @@ IMPL_LINK_NOARG(SvxCharacterMap, CharPreSelectHdl) // adjust subset selection if( pSubsetMap ) { - sal_UCS4 cChar = aShowSet.GetSelectCharacter(); + sal_UCS4 cChar = m_pShowSet->GetSelectCharacter(); const Subset* pSubset = pSubsetMap->GetSubsetByUnicode( cChar ); if( pSubset ) - aSubsetLB.SelectEntry( pSubset->GetName() ); + m_pSubsetLB->SelectEntry( pSubset->GetName() ); } - aOKBtn.Enable(); + m_pOKBtn->Enable(); return 0; } @@ -544,8 +543,8 @@ IMPL_LINK_NOARG(SvxCharacterMap, CharPreSelectHdl) IMPL_LINK_NOARG(SvxCharacterMap, DeleteHdl) { - aShowText.SetText( String() ); - aOKBtn.Disable(); + m_pShowText->SetText( String() ); + m_pOKBtn->Disable(); return 0; } diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx index e65d314..8c89003 100644 --- a/cui/source/factory/dlgfact.cxx +++ b/cui/source/factory/dlgfact.cxx @@ -1302,24 +1302,13 @@ AbstractSvxHlinkDlgMarkWnd* AbstractDialogFactory_Impl::CreateSvxHlinkDlgMarkWnd return 0; } -SfxAbstractDialog* AbstractDialogFactory_Impl::CreateSfxDialog( sal_uInt32 nResId, +SfxAbstractDialog* AbstractDialogFactory_Impl::CreateSfxDialog( sal_uInt32, Window* pParent, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& , const SfxItemSet* pAttrSet ) { - SfxModalDialog* pDlg=NULL; - switch ( nResId ) - { - case RID_SVXDLG_CHARMAP : - pDlg = new SvxCharacterMap( pParent, sal_True, pAttrSet ); - break; - default: - break; - } - - if ( pDlg ) - return new AbstractSfxDialog_Impl( pDlg ); - return 0; + SfxModalDialog* pDlg = new SvxCharacterMap( pParent, sal_True, pAttrSet ); + return new AbstractSfxDialog_Impl( pDlg ); } SfxAbstractTabDialog* AbstractDialogFactory_Impl::CreateTabItemDialog( Window* pParent, diff --git a/cui/source/inc/cuicharmap.hxx b/cui/source/inc/cuicharmap.hxx index dc8e42b..4fa43ce 100644 --- a/cui/source/inc/cuicharmap.hxx +++ b/cui/source/inc/cuicharmap.hxx @@ -61,10 +61,15 @@ public: SvxShowText( Window* pParent, const ResId& rResId, sal_Bool bCenter = sal_False ); + SvxShowText( Window* pParent, + sal_Bool bCenter = sal_False ); ~SvxShowText(); void SetFont( const Font& rFont ); void SetText( const String& rText ); + void SetCentered(bool bCenter) { mbCenter = bCenter; } + + virtual void Resize(); protected: virtual void Paint( const Rectangle& ); @@ -81,19 +86,17 @@ private: void init(); - SvxShowCharSet aShowSet; - SvxShowText aShowText; - OKButton aOKBtn; - CancelButton aCancelBtn; - HelpButton aHelpBtn; - PushButton aDeleteBtn; - FixedText aFontText; - ListBox aFontLB; - FixedText aSubsetText; - ListBox aSubsetLB; - FixedText aSymbolText; - SvxShowText aShowChar; - FixedText aCharCodeText; + SvxShowCharSet* m_pShowSet; + SvxShowText* m_pShowText; + OKButton* m_pOKBtn; + PushButton* m_pDeleteBtn; + FixedText* m_pFontText; + ListBox* m_pFontLB; + FixedText* m_pSubsetText; + ListBox* m_pSubsetLB; + FixedText* m_pSymbolText; + SvxShowText* m_pShowChar; + FixedText* m_pCharCodeText; Font aFont; sal_Bool bOne; const SubsetMap* pSubsetMap; diff --git a/cui/source/tabpages/chardlg.cxx b/cui/source/tabpages/chardlg.cxx index c2a9d9b..b957b80 100644 --- a/cui/source/tabpages/chardlg.cxx +++ b/cui/source/tabpages/chardlg.cxx @@ -3338,26 +3338,20 @@ void SvxCharTwoLinesPage::Initialize() void SvxCharTwoLinesPage::SelectCharacter( ListBox* pBox ) { - bool bStart = pBox == m_pStartBracketLB; - //SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - //if(pFact) - { - //AbstractSvxCharacterMap* aDlg = pFact->CreateSvxCharacterMap( this, RID_SVXDLG_CHARMAP ); - SvxCharacterMap* aDlg = new SvxCharacterMap( this ); - aDlg->DisableFontSelection(); + SvxCharacterMap* aDlg = new SvxCharacterMap( this ); + aDlg->DisableFontSelection(); - if ( aDlg->Execute() == RET_OK ) - { - sal_Unicode cChar = (sal_Unicode) aDlg->GetChar(); - SetBracket( cChar, bStart ); - } - else - { - pBox->SelectEntryPos( bStart ? m_nStartBracketPosition : m_nEndBracketPosition ); - } - delete aDlg; + if ( aDlg->Execute() == RET_OK ) + { + sal_Unicode cChar = (sal_Unicode) aDlg->GetChar(); + SetBracket( cChar, bStart ); + } + else + { + pBox->SelectEntryPos( bStart ? m_nStartBracketPosition : m_nEndBracketPosition ); } + delete aDlg; } // ----------------------------------------------------------------------- diff --git a/svx/inc/svx/charmap.hxx b/svx/inc/svx/charmap.hxx index f5bb08b..b6b1d71 100644 --- a/svx/inc/svx/charmap.hxx +++ b/svx/inc/svx/charmap.hxx @@ -55,6 +55,7 @@ class SVX_DLLPUBLIC SvxShowCharSet : public Control { public: SvxShowCharSet( Window* pParent, const ResId& rResId ); + SvxShowCharSet( Window* pParent ); ~SvxShowCharSet(); void SetFont( const Font& rFont ); @@ -89,6 +90,8 @@ public: sal_Int32 getMaxCharCount() const; #endif // _SVX_CHARMAP_CXX_ + virtual void Resize(); + protected: virtual void Paint( const Rectangle& ); virtual void MouseButtonDown( const MouseEvent& rMEvt ); @@ -132,6 +135,8 @@ private: // abstraction layers are: Unicode<->MapIndex<->Pixel Point MapIndexToPixel( int) const; DECL_LINK(VscrollHdl, void *); + + void init(); }; #endif diff --git a/svx/source/dialog/charmap.cxx b/svx/source/dialog/charmap.cxx index 409d5cb..45590db 100644 --- a/svx/source/dialog/charmap.cxx +++ b/svx/source/dialog/charmap.cxx @@ -65,10 +65,25 @@ sal_uInt32& SvxShowCharSet::getSelectedChar() #define SBWIDTH 16 -SvxShowCharSet::SvxShowCharSet( Window* pParent, const ResId& rResId ) : - Control( pParent, rResId ) - ,m_pAccessible(NULL) - ,aVscrollSB( this, WB_VERT) +SvxShowCharSet::SvxShowCharSet(Window* pParent, const ResId& rResId) + : Control(pParent, rResId) + , m_pAccessible(NULL) + , aVscrollSB(this, WB_VERT) +{ + init(); + InitSettings( sal_True, sal_True ); +} + +SvxShowCharSet::SvxShowCharSet(Window* pParent) + : Control(pParent) + , m_pAccessible(NULL) + , aVscrollSB( this, WB_VERT) +{ + init(); + InitSettings( sal_True, sal_True ); +} + +void SvxShowCharSet::init() { nSelectedIndex = -1; // TODO: move into init list when it is no longer static @@ -81,7 +96,21 @@ SvxShowCharSet::SvxShowCharSet( Window* pParent, const ResId& rResId ) : // other settings like aVscroll depend on selected font => see SetFont bDrag = sal_False; - InitSettings( sal_True, sal_True ); +} + +void SvxShowCharSet::Resize() +{ + aOrigSize = GetOutputSizePixel(); + aOrigPos = GetPosPixel(); + + Control::Resize(); + + SetFont(GetFont()); //force recalculation of correct fontsize +} + +extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeSvxShowCharSet(Window *pParent, VclBuilder::stringmap &) +{ + return new SvxShowCharSet(pParent); } // ----------------------------------------------------------------------- commit 5730c1e554476f35fbeb0da35932e390c2a39fc0 Author: Gokul <gokul.c...@gmail.com> Date: Wed Sep 26 15:23:26 2012 +0100 add special character dialog Change-Id: I9f5e6846593ab34995518598294950b34f91b83f diff --git a/cui/uiconfig/ui/specialcharacters.ui b/cui/uiconfig/ui/specialcharacters.ui new file mode 100644 index 0000000..94287d8 --- /dev/null +++ b/cui/uiconfig/ui/specialcharacters.ui @@ -0,0 +1,284 @@ +<?xml version="1.0" encoding="UTF-8"?> +<interface> + <!-- interface-requires gtk+ 3.0 --> + <object class="GtkDialog" id="SpecialCharactersDialog"> + <property name="can_focus">False</property> + <property name="border_width">5</property> + <property name="title" translatable="yes">Special Characters</property> + <property name="resizable">False</property> + <property name="type_hint">dialog</property> + <child internal-child="vbox"> + <object class="GtkBox" id="dialog-vbox1"> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <property name="spacing">2</property> + <child internal-child="action_area"> + <object class="GtkButtonBox" id="dialog-action_area1"> + <property name="can_focus">False</property> + <property name="layout_style">end</property> + <child> + <object class="GtkButton" id="ok"> + <property name="label">gtk-ok</property> + <property name="use_action_appearance">False</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="has_default">True</property> + <property name="receives_default">True</property> + <property name="use_action_appearance">False</property> + <property name="use_stock">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkButton" id="cancel"> + <property name="label">gtk-cancel</property> + <property name="use_action_appearance">False</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_action_appearance">False</property> + <property name="use_stock">True</property> + <property name="xalign">0.50999999046325684</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkButton" id="help"> + <property name="label">gtk-help</property> + <property name="use_action_appearance">False</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_action_appearance">False</property> + <property name="use_stock">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + <child> + <object class="GtkButton" id="delete"> + <property name="label">gtk-delete</property> + <property name="use_action_appearance">False</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_action_appearance">False</property> + <property name="use_stock">True</property> + <property name="image_position">bottom</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">3</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="pack_type">end</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkBox" id="box1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <child> + <object class="GtkGrid" id="grid1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="row_spacing">6</property> + <property name="column_spacing">6</property> + <child> + <object class="GtkGrid" id="grid2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="column_spacing">6</property> + <child> + <object class="GtkLabel" id="fontft"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Font</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="subsetft"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Subset</property> + </object> + <packing> + <property name="left_attach">2</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkComboBox" id="fontlb"> + <property name="visible">True</property> + <property name="can_focus">False</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkComboBox" id="subsetlb"> + <property name="visible">True</property> + <property name="can_focus">False</property> + </object> + <packing> + <property name="left_attach">3</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkGrid" id="grid3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child> + <object class="GtkLabel" id="charcodeft"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">U+0020(32)</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">1</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="cuilo:SvxShowText" id="showchar"> + <property name="width_request">100</property> + <property name="height_request">150</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">1</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="svxlo:SvxShowCharSet" id="showcharset"> + <property name="width_request">400</property> + <property name="height_request">250</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">1</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <placeholder/> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkBox" id="box2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="spacing">6</property> + <child> + <object class="GtkLabel" id="symboltext"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Characters:</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="cuilo:SvxShowText" id="showtext"> + <property name="visible">True</property> + <property name="can_focus">False</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + </child> + <action-widgets> + <action-widget response="0">ok</action-widget> + <action-widget response="0">cancel</action-widget> + <action-widget response="0">help</action-widget> + <action-widget response="0">delete</action-widget> + </action-widgets> + </object> +</interface>
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits