1/**************************************************************
| 1/**************************************************************
|
2 *
| 2 *
|
3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at
| 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at
|
10 *
| 10 *
|
11 * http://www.apache.org/licenses/LICENSE-2.0
| 11 * http://www.apache.org/licenses/LICENSE-2.0
|
12 *
| 12 *
|
13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License.
| 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License.
|
19 *
| 19 *
|
20 *************************************************************/ 21
| 20 *************************************************************/ 21
|
| 22 23
|
22#include "precompiled_sw.hxx" 23 24#include "PageColumnControl.hxx" 25#include "PagePropertyPanel.hxx" 26#include "PagePropertyPanel.hrc" 27 28#include <cmdid.h> 29#include <swtypes.hxx> 30 31#include <svx/sidebar/ValueSetWithTextControl.hxx> 32#include <sfx2/bindings.hxx> 33#include <sfx2/dispatch.hxx> 34 35namespace sw { namespace sidebar { 36 37PageColumnControl::PageColumnControl(
| 24#include "precompiled_sw.hxx" 25 26#include "PageColumnControl.hxx" 27#include "PagePropertyPanel.hxx" 28#include "PagePropertyPanel.hrc" 29 30#include <cmdid.h> 31#include <swtypes.hxx> 32 33#include <svx/sidebar/ValueSetWithTextControl.hxx> 34#include <sfx2/bindings.hxx> 35#include <sfx2/dispatch.hxx> 36 37namespace sw { namespace sidebar { 38 39PageColumnControl::PageColumnControl(
|
38 Window* pParent, 39 PagePropertyPanel& rPanel, 40 const sal_uInt16 nColumnType, 41 const bool bLandscape ) 42 : ::svx::sidebar::PopupControl( pParent, SW_RES(RID_POPUP_SWPAGE_COLUMN) ) 43 , mpColumnValueSet( new ::svx::sidebar::ValueSetWithTextControl( ::svx::sidebar::ValueSetWithTextControl::IMAGE_TEXT, this, SW_RES(VS_COLUMN) ) ) 44 , maMoreButton( this, SW_RES(CB_COLUMN_MORE) ) 45 , mnColumnType( nColumnType ) 46 , mrPagePropPanel(rPanel)
| 40 Window* pParent, 41 PagePropertyPanel& rPanel, 42 const sal_uInt16 nColumnType, 43 const bool bLandscape ) 44 : ::svx::sidebar::PopupControl( pParent, SW_RES(RID_POPUP_SWPAGE_COLUMN) ) 45 , mpColumnValueSet( new ::svx::sidebar::ValueSetWithTextControl( ::svx::sidebar::ValueSetWithTextControl::IMAGE_TEXT, this, SW_RES(VS_COLUMN) ) ) 46 , maMoreButton( this, SW_RES(CB_COLUMN_MORE) ) 47 , mnColumnType( nColumnType ) 48 , mrPagePropPanel(rPanel)
|
47{
| 49{
|
48 mpColumnValueSet->SetStyle( mpColumnValueSet->GetStyle() | WB_3DLOOK | WB_NO_DIRECTSELECT ); 49 mpColumnValueSet->SetColor(GetSettings().GetStyleSettings().GetMenuColor());
| 50 mpColumnValueSet->SetStyle( mpColumnValueSet->GetStyle() | WB_3DLOOK | WB_NO_DIRECTSELECT ); 51 mpColumnValueSet->SetColor(GetSettings().GetStyleSettings().GetMenuColor());
|
50
| 52
|
51 if ( bLandscape ) 52 { 53 mpColumnValueSet->AddItem( SW_RES(IMG_ONE_L), 0, SW_RES(STR_ONE), 0 ); 54 mpColumnValueSet->AddItem( SW_RES(IMG_TWO_L), 0, SW_RES(STR_TWO), 0 ); 55 mpColumnValueSet->AddItem( SW_RES(IMG_THREE_L), 0, SW_RES(STR_THREE), 0 ); 56 mpColumnValueSet->AddItem( SW_RES(IMG_LEFT_L), 0, SW_RES(STR_LEFT), 0 ); 57 mpColumnValueSet->AddItem( SW_RES(IMG_RIGHT_L), 0, SW_RES(STR_RIGHT), 0 ); 58 } 59 else 60 { 61 mpColumnValueSet->AddItem( SW_RES(IMG_ONE), 0, SW_RES(STR_ONE), 0 ); 62 mpColumnValueSet->AddItem( SW_RES(IMG_TWO), 0, SW_RES(STR_TWO), 0 ); 63 mpColumnValueSet->AddItem( SW_RES(IMG_THREE), 0, SW_RES(STR_THREE), 0 ); 64 mpColumnValueSet->AddItem( SW_RES(IMG_LEFT), 0, SW_RES(STR_LEFT), 0 ); 65 mpColumnValueSet->AddItem( SW_RES(IMG_RIGHT), 0, SW_RES(STR_RIGHT), 0 ); 66 }
| 53 if ( bLandscape ) 54 { 55 mpColumnValueSet->AddItem( SW_RES(IMG_ONE_L), 0, SW_RES(STR_ONE), 0 ); 56 mpColumnValueSet->AddItem( SW_RES(IMG_TWO_L), 0, SW_RES(STR_TWO), 0 ); 57 mpColumnValueSet->AddItem( SW_RES(IMG_THREE_L), 0, SW_RES(STR_THREE), 0 ); 58 mpColumnValueSet->AddItem( SW_RES(IMG_LEFT_L), 0, SW_RES(STR_LEFT), 0 ); 59 mpColumnValueSet->AddItem( SW_RES(IMG_RIGHT_L), 0, SW_RES(STR_RIGHT), 0 ); 60 } 61 else 62 { 63 mpColumnValueSet->AddItem( SW_RES(IMG_ONE), 0, SW_RES(STR_ONE), 0 ); 64 mpColumnValueSet->AddItem( SW_RES(IMG_TWO), 0, SW_RES(STR_TWO), 0 ); 65 mpColumnValueSet->AddItem( SW_RES(IMG_THREE), 0, SW_RES(STR_THREE), 0 ); 66 mpColumnValueSet->AddItem( SW_RES(IMG_LEFT), 0, SW_RES(STR_LEFT), 0 ); 67 mpColumnValueSet->AddItem( SW_RES(IMG_RIGHT), 0, SW_RES(STR_RIGHT), 0 ); 68 }
|
67
| 69
|
68 mpColumnValueSet->SetNoSelection(); 69 mpColumnValueSet->SetSelectHdl( LINK(this, PageColumnControl,ImplColumnHdl ) ); 70 mpColumnValueSet->Show(); 71 mpColumnValueSet->SelectItem( mnColumnType ); 72 mpColumnValueSet->Format(); 73 mpColumnValueSet->StartSelection();
| 70 mpColumnValueSet->SetNoSelection(); 71 mpColumnValueSet->SetSelectHdl( LINK(this, PageColumnControl,ImplColumnHdl ) ); 72 mpColumnValueSet->Show(); 73 mpColumnValueSet->SelectItem( mnColumnType ); 74 mpColumnValueSet->Format(); 75 mpColumnValueSet->StartSelection();
|
74
| 76
|
75 maMoreButton.SetClickHdl( LINK( this, PageColumnControl, MoreButtonClickHdl_Impl ) ); 76 maMoreButton.GrabFocus();
| 77 maMoreButton.SetClickHdl( LINK( this, PageColumnControl, MoreButtonClickHdl_Impl ) ); 78 maMoreButton.GrabFocus();
|
77
| 79
|
78 FreeResource();
| 80 FreeResource();
|
79} 80 81 82PageColumnControl::~PageColumnControl(void) 83{
| 81} 82 83 84PageColumnControl::~PageColumnControl(void) 85{
|
84 delete mpColumnValueSet;
| 86 delete mpColumnValueSet;
|
85} 86 87 88IMPL_LINK(PageColumnControl, ImplColumnHdl, void *, pControl) 89{
| 87} 88 89 90IMPL_LINK(PageColumnControl, ImplColumnHdl, void *, pControl) 91{
|
90 mpColumnValueSet->SetNoSelection(); 91 if ( pControl == mpColumnValueSet ) 92 { 93 const sal_uInt32 nColumnType = mpColumnValueSet->GetSelectItemId(); 94 if ( nColumnType != mnColumnType ) 95 { 96 mnColumnType = nColumnType; 97 mrPagePropPanel.ExecuteColumnChange( mnColumnType ); 98 } 99 }
| 92 mpColumnValueSet->SetNoSelection(); 93 if ( pControl == mpColumnValueSet ) 94 { 95 const sal_uInt32 nColumnType = mpColumnValueSet->GetSelectItemId(); 96 if ( nColumnType != mnColumnType ) 97 { 98 mnColumnType = nColumnType; 99 mrPagePropPanel.ExecuteColumnChange( mnColumnType ); 100 } 101 }
|
100
| 102
|
101 mrPagePropPanel.ClosePageColumnPopup(); 102 return 0;
| 103 mrPagePropPanel.ClosePageColumnPopup(); 104 return 0;
|
103} 104 105IMPL_LINK(PageColumnControl, MoreButtonClickHdl_Impl, void *, EMPTYARG) 106{
| 105} 106 107IMPL_LINK(PageColumnControl, MoreButtonClickHdl_Impl, void *, EMPTYARG) 108{
|
107 mrPagePropPanel.GetBindings()->GetDispatcher()->Execute( FN_FORMAT_PAGE_COLUMN_DLG, SFX_CALLMODE_ASYNCHRON );
| 109 mrPagePropPanel.GetBindings()->GetDispatcher()->Execute( FN_FORMAT_PAGE_COLUMN_DLG, SFX_CALLMODE_ASYNCHRON );
|
108
| 110
|
109 mrPagePropPanel.ClosePageColumnPopup(); 110 return 0;
| 111 mrPagePropPanel.ClosePageColumnPopup(); 112 return 0;
|
111} 112 113 114} } // end of namespace sw::sidebar 115
| 113} 114 115 116} } // end of namespace sw::sidebar 117
|
| 118/* vim: set noet sw=4 ts=4: */
|
| |